// Validate validates a new client
324581
func (strategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {
	token := obj.(*oauthapi.OAuthClient)
	return validation.ValidateClient(token)
}
1097301
func (c *GroupsCreateCall) Validate(validate bool) *GroupsCreateCall {
	c.validate = validate
	return c
}
1038125
func (s *XPackInfoService) Validate() error {
	var invalid []string
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}
931422
func (c *initiateCommand) validate(expectedClientShortNonce *shortNonce, expectedPermServerPubkey permanentServerPubkey,
	cookieKey [32]byte) (permanentClientPubkey, ephemeralClientPubkey, ephemeralServerPrivkey, error) {

	// FIXME: to support metadata, bump the size of this buffer.
	if c.curlen != 257 {
		return permanentClientPubkey{}, ephemeralClientPubkey{}, ephemeralServerPrivkey{}, fmt.Errorf("wrong INITIATE length %d", c.curlen)
	}

	srcHeader := c.buf[:9]
	srcReceivedCookie := c.buf[9 : 9+96]
	srcUnprefixedNonce := c.buf[9+96 : 9+96+8]
	srcEncInitiateBox := c.buf[9+96+8 : 9+96+8+144]

	/* Validate the header. */
	if bytes.Compare(srcHeader, []byte{8, 'I', 'N', 'I', 'T', 'I', 'A', 'T', 'E'}) != 0 {
		return permanentClientPubkey{}, ephemeralClientPubkey{}, ephemeralServerPrivkey{}, fmt.Errorf("malformed INITIATE header")
	}

	/* Check the nonce. */
	cn, err := readShortNonce(srcUnprefixedNonce)
	if err != nil {
		return permanentClientPubkey{}, ephemeralClientPubkey{}, ephemeralServerPrivkey{}, err
	}
	if !expectedClientShortNonce.same(cn) {
		return permanentClientPubkey{}, ephemeralClientPubkey{}, ephemeralServerPrivkey{}, fmt.Errorf("client nonce not in sequence: %d != %d", expectedClientShortNonce.uint64(), cn)
	}
	prefixedNonce, _, err := expectedClientShortNonce.prefixAndBump(initiateNoncePrefix)
	if err != nil {
		return permanentClientPubkey{}, ephemeralClientPubkey{}, ephemeralServerPrivkey{}, err
	}

	/* Decrypt the cookie, get client's ephemeral pubkey and my own ephemeral privkey . */
	var cookie serverCookie
	copy(cookie[:], srcReceivedCookie)
	ephClientPubkeyFromCookie, ephServerPrivkeyFromCookie, ok, err := cookie.decrypt(cookieKey)
	if err != nil {
		return permanentClientPubkey{}, ephemeralClientPubkey{}, ephemeralServerPrivkey{}, err
	}
	if !ok {
		return permanentClientPubkey{}, ephemeralClientPubkey{}, ephemeralServerPrivkey{}, fmt.Errorf("cannot validate cookie")
	}

	/* Decrypt the initiate box. */
	Cprime := [32]byte(ephClientPubkeyFromCookie)
	Sprime := [32]byte(ephServerPrivkeyFromCookie)
	initiateBox, ok := box.Open(nil, srcEncInitiateBox, &prefixedNonce, &Cprime, &Sprime)
	if !ok {
		return permanentClientPubkey{}, ephemeralClientPubkey{}, ephemeralServerPrivkey{}, fmt.Errorf("cannot validate client initiate box")
	}

	/* Get permanent client pubkey aend encrypted vouch from initiate box */
	var permClientPubkey permanentClientPubkey
	var vouch clientVouch
	copy(permClientPubkey[:], initiateBox[:32])
	copy(vouch[:], initiateBox[32:])

	/* Decrypt the vouch, get client's ephemeral pubkey and server's permanent pubkey. */
	ephClientPubkeyFromVouch, permServerPubkeyFromVouch, ok, err := vouch.decrypt(permClientPubkey, ephServerPrivkeyFromCookie)
	if err != nil {
		return permanentClientPubkey{}, ephemeralClientPubkey{}, ephemeralServerPrivkey{}, err
	}
	if !ok {
		return permanentClientPubkey{}, ephemeralClientPubkey{}, ephemeralServerPrivkey{}, fmt.Errorf("cannot validate client vouch")
	}

	/* Validate keys. */
	if ephClientPubkeyFromCookie != ephClientPubkeyFromVouch {
		return permanentClientPubkey{}, ephemeralClientPubkey{}, ephemeralServerPrivkey{}, fmt.Errorf("ephemeral client public keys differ between cookie and vouch")
	}
	if permServerPubkeyFromVouch != expectedPermServerPubkey {
		return permanentClientPubkey{}, ephemeralClientPubkey{}, ephemeralServerPrivkey{}, fmt.Errorf("permanent server public keys differ between cookie and vouch")
	}

	return permClientPubkey, ephClientPubkeyFromVouch, ephServerPrivkeyFromCookie, nil
}
526907
func (c *HTTPClientConfig) Validate() error {
	if len(c.BearerToken) > 0 && len(c.BearerTokenFile) > 0 {
		return fmt.Errorf("at most one of bearer_token & bearer_token_file must be configured")
	}
	if c.BasicAuth != nil && (len(c.BearerToken) > 0 || len(c.BearerTokenFile) > 0) {
		return fmt.Errorf("at most one of basic_auth, bearer_token & bearer_token_file must be configured")
	}
	if c.BasicAuth != nil && (string(c.BasicAuth.Password) != "" && c.BasicAuth.PasswordFile != "") {
		return fmt.Errorf("at most one of basic_auth password & password_file must be configured")
	}
	return nil
}
535066
func (c *ChannelsJoinCall) Validate(validate bool) *ChannelsJoinCall {
	c.validate = validate
	return c
}
710946
func (c *Config) Validate() error {
	c.assertInitialized()
	for _, h := range c.configHandlers {
		if err := h.Validate(c); err != nil {
			return err
		}
	}
	return nil
}
137511
func (m *Error) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateCode(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateHelpURL(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateMessage(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
432111
func (ex *exampleValidator) Validate() (errs *Result) {
	errs = new(Result)
	if ex == nil || ex.SpecValidator == nil {
		return errs
	}
	ex.resetVisited()
	errs.Merge(ex.validateExampleValueValidAgainstSchema()) // error -

	return errs
}
475876
func (c *Configuration) validate() error {
	if c.Prefix == "" {
		return fmt.Errorf("prefix must be specified")
	}

	if c.KeyCreator == nil {
		return fmt.Errorf("KeyCreator must be specified")
	}

	if c.SynchronizationInterval == 0 {
		c.SynchronizationInterval = option.Config.KVstorePeriodicSync
	}

	if c.Backend == nil {
		c.Backend = kvstore.Client()
	}

	return nil
}
70328
func (m *Body) Validate() error {
	if m == nil {
		return nil
	}

	// no validation rules for Truncated

	switch m.BodyType.(type) {

	case *Body_AsBytes:
		// no validation rules for AsBytes

	case *Body_AsString:
		// no validation rules for AsString

	}

	return nil
}
556336
func (c Code) Validate(_ interface{}) error {
	if codeRegex.Match([]byte(c)) {
		return nil
	}

	return errInvalidCode
}
893029
func (c *ChannelsRenameCall) Validate(validate bool) *ChannelsRenameCall {
	c.validate = validate
	return c
}
1339854
func (config Config) Validate() error {
	if config.APICaller == nil {
		return errors.NotValidf("nil APICaller")
	}
	if config.AgentConfig == nil {
		return errors.NotValidf("nil AgentConfig")
	}
	if config.MachineLock == nil {
		return errors.NotValidf("nil MachineLock")
	}
	if config.NewBrokerFunc == nil {
		return errors.NotValidf("nil NewBrokerFunc")
	}
	if config.NewStateFunc == nil {
		return errors.NotValidf("nil NewStateFunc")
	}
	return nil
}
731780
func (config Config) Validate() error {
	if config.Observer == nil {
		return errors.NotValidf("nil Observer")
	}
	if config.NewEnvironFunc == nil {
		return errors.NotValidf("nil NewEnvironFunc")
	}
	return nil
}
111306
func (config ManifoldConfig) Validate() error {
	if config.AgentName == "" {
		return errors.NotValidf("empty AgentName")
	}
	if config.APICallerName == "" {
		return errors.NotValidf("empty APICallerName")
	}
	if config.MachineLock == nil {
		return errors.NotValidf("nil MachineLock")
	}
	if config.NewBrokerFunc == nil {
		return errors.NotValidf("nil NewBrokerFunc")
	}
	if config.NewTracker == nil {
		return errors.NotValidf("nil NewTracker")
	}
	return nil
}
1270495
func (s *CredentialServer) Validate(
	ctx context.Context,
	req *api.SdkCredentialValidateRequest,
) (*api.SdkCredentialValidateResponse, error) {
	if s.driver(ctx) == nil {
		return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
	}

	if len(req.GetCredentialId()) == 0 {
		return nil, status.Error(codes.InvalidArgument, "Must provide credentials uuid")
	}

	// Check ownership
	_, err := s.Inspect(ctx, &api.SdkCredentialInspectRequest{
		CredentialId: req.GetCredentialId(),
	})
	if err != nil {
		return nil, err
	}

	err = s.driver(ctx).CredsValidate(req.GetCredentialId())
	if err != nil {
		return nil, status.Errorf(
			codes.Internal,
			"failed to validate credentials: %v",
			err.Error())
	}
	return &api.SdkCredentialValidateResponse{}, nil

}