// Manufacture will create a lock of a given type according to the input parameters
969663
func New(lockType string, ns string, name string, coreClient corev1.CoreV1Interface, coordinationClient coordinationv1.CoordinationV1Interface, rlc ResourceLockConfig) (Interface, error) {
	switch lockType {
	case EndpointsResourceLock:
		return &EndpointsLock{
			EndpointsMeta: metav1.ObjectMeta{
				Namespace: ns,
				Name:      name,
			},
			Client:     coreClient,
			LockConfig: rlc,
		}, nil
	case ConfigMapsResourceLock:
		return &ConfigMapLock{
			ConfigMapMeta: metav1.ObjectMeta{
				Namespace: ns,
				Name:      name,
			},
			Client:     coreClient,
			LockConfig: rlc,
		}, nil
	case LeasesResourceLock:
		return &LeaseLock{
			LeaseMeta: metav1.ObjectMeta{
				Namespace: ns,
				Name:      name,
			},
			Client:     coordinationClient,
			LockConfig: rlc,
		}, nil
	default:
		return nil, fmt.Errorf("Invalid lock-type %s", lockType)
	}
}
880342
func makeWriter(typ reflect.Type, ts tags) (writer, error) {
	kind := typ.Kind()
	switch {
	case typ == rawValueType:
		return writeRawValue, nil
	case typ.Implements(encoderInterface):
		return writeEncoder, nil
	case kind != reflect.Ptr && reflect.PtrTo(typ).Implements(encoderInterface):
		return writeEncoderNoPtr, nil
	case kind == reflect.Interface:
		return writeInterface, nil
	case typ.AssignableTo(reflect.PtrTo(bigInt)):
		return writeBigIntPtr, nil
	case typ.AssignableTo(bigInt):
		return writeBigIntNoPtr, nil
	case isUint(kind):
		return writeUint, nil
	case kind == reflect.Bool:
		return writeBool, nil
	case kind == reflect.String:
		return writeString, nil
	case kind == reflect.Slice && isByte(typ.Elem()):
		return writeBytes, nil
	case kind == reflect.Array && isByte(typ.Elem()):
		return writeByteArray, nil
	case kind == reflect.Slice || kind == reflect.Array:
		return makeSliceWriter(typ, ts)
	case kind == reflect.Struct:
		return makeStructWriter(typ)
	case kind == reflect.Ptr:
		return makePtrWriter(typ)
	default:
		return nil, fmt.Errorf("rlp: type %v is not RLP-serializable", typ)
	}
}
565726
func Make(subject, predicate, object, label interface{}) (q Quad) {
	var ok bool
	if q.Subject, ok = AsValue(subject); !ok {
		q.Subject = String(fmt.Sprint(subject))
	}
	if q.Predicate, ok = AsValue(predicate); !ok {
		q.Predicate = String(fmt.Sprint(predicate))
	}
	if q.Object, ok = AsValue(object); !ok {
		q.Object = String(fmt.Sprint(object))
	}
	if q.Label, ok = AsValue(label); !ok {
		q.Label = String(fmt.Sprint(label))
	}
	return
}
425846
func Register(name string, factory acl.Factory) {
	mu.Lock()
	defer mu.Unlock()
	if _, ok := acls[name]; ok {
		panic(fmt.Sprintf("register a registered key: %s", name))
	}
	acls[name] = factory
}
1065276
func (s *CreatePhoneNumberOrderInput) SetProductType(v string) *CreatePhoneNumberOrderInput {
	s.ProductType = &v
	return s
}
1020471
func (b *OpenAPI3Builder) buildTypeFromParameters(
	name string,
	parameters []*openapiv3.ParameterOrReference,
	requestBody *openapiv3.RequestBodyOrReference) (typeName string, err error) {
	t := &Type{}
	t.Name = name + "Parameters"
	t.Description = t.Name + " holds parameters to " + name
	t.Kind = TypeKind_STRUCT
	t.Fields = make([]*Field, 0)
	for _, parametersItem := range parameters {
		var f Field
		f.Type = fmt.Sprintf("%+v", parametersItem)
		parameter := parametersItem.GetParameter()
		if parameter != nil {
			switch parameter.In {
			case "body":
				f.Position = Position_BODY
			case "header":
				f.Position = Position_HEADER
			case "formdata":
				f.Position = Position_FORMDATA
			case "query":
				f.Position = Position_QUERY
			case "path":
				f.Position = Position_PATH
			}
			f.Name = parameter.Name
			if parameter.GetSchema() != nil && parameter.GetSchema() != nil {
				f.Kind, f.Type, f.Format = b.typeForSchemaOrReference(parameter.GetSchema())
			}
			f.Serialize = true
			t.addField(&f)
		}
	}
	if requestBody != nil {
		content := requestBody.GetRequestBody().GetContent()
		if content != nil {
			for _, pair2 := range content.GetAdditionalProperties() {
				if pair2.Name != "application/json" {
					log.Printf("unimplemented: %q requestBody(%s)", name, pair2.Name)
					continue
				}
				var f Field
				f.Position = Position_BODY
				f.Kind, f.Type, f.Format = b.typeForSchemaOrReference(pair2.GetValue().GetSchema())
				f.Name = strings.ToLower(f.Type) // use the schema name as the parameter name, since none is directly specified
				f.Serialize = true
				t.addField(&f)
			}
		}
	}
	if len(t.Fields) > 0 {
		b.model.addType(t)
		return t.Name, err
	}
	return "", err
}
1148303
func makeResponse(request *http.Request, w http.ResponseWriter) *Response {
	response := &Response{
		request: request,
		writer:  w,
		Cookie:  Cookie{},
	}

	return response
}
120638
func MakeAddition(key string, newVal interface{}) ItemChange {
	return ItemChange{
		Type:     added,
		Key:      key,
		NewValue: newVal,
	}
}
432951
func Register(name string, factory ValidatorFactory) {
	typesMu.Lock()
	defer typesMu.Unlock()
	if factory == nil {
		panic("authmethod: Register factory is nil for type " + name)
	}
	if _, dup := types[name]; dup {
		panic("authmethod: Register called twice for type " + name)
	}
	types[name] = factory
}
1325619
func MakeRaw(fd int) (*State, error) {
	var st uint32
	_, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
	if e != 0 {
		return nil, error(e)
	}
	raw := st &^ (enableEchoInput | enableProcessedInput | enableLineInput | enableProcessedOutput)
	_, _, e = syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(raw), 0)
	if e != 0 {
		return nil, error(e)
	}
	return &State{st}, nil
}
699588
func (m *Mercury) CreateLock(key string, ttl int) (lock.DistributedLock, error) {
	lockKey := fmt.Sprintf("%s/%s", m.config.Etcd.LockPrefix, key)
	mutex, err := etcdlock.New(m.cliv3, lockKey, ttl)
	return mutex, err
}
1183838
func (s *CreateProductInput) SetProductType(v string) *CreateProductInput {
	s.ProductType = &v
	return s
}
802642
func (apiDef *APIDefinition) createType(name string, tip interface{},
	inputProps map[interface{}]interface{}) bool {

	created := false
	// check that there is no type with this name
	if _, exist := apiDef.Types[name]; exist {
		return created
	}

	// convert the inputProps to properties
	props := make(map[string]interface{})

	for k, p := range inputProps {
		name, ok := k.(string)
		if !ok {
			panic(fmt.Errorf("property key:%v need to be a string", k))
		}
		props[name] = p
	}

	t := Type{
		Name:       name,
		Type:       tip,
		Properties: props,
	}
	apiDef.Types[name] = t
	created = true
	return created
}
1085396
func (mr *MockDependencyCompilerMockRecorder) Compile(arg0, arg1 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Compile", reflect.TypeOf((*MockDependencyCompiler)(nil).Compile), arg0, arg1)
}
1281574
func Register(format string, p Packager) {
	lock.Lock()
	packagers[format] = p
	lock.Unlock()
}
1335900
func MakeRandomBlockCryptKeyServerHalf() (
	serverHalf BlockCryptKeyServerHalf, err error) {
	var data [32]byte
	err = RandRead(data[:])
	if err != nil {
		return BlockCryptKeyServerHalf{}, err
	}
	serverHalf = MakeBlockCryptKeyServerHalf(data)
	return serverHalf, nil
}
1322229
func MakeNewType(t reflect.Type, bufcap int) (val reflect.Value) {
	switch t.Kind() {
	case reflect.Ptr:
		val = reflect.New(t).Elem()
		val.Set(reflect.New(val.Type().Elem()))
	case reflect.Chan:
		//typ := reflect.ChanOf(reflect.BothDir, t.Elem())
		val = reflect.New(t).Elem()
		val.Set(reflect.MakeChan(t, bufcap)) //TODO: set buf?
	case reflect.Slice:
		val = reflect.New(t).Elem()
		val.Set(reflect.MakeSlice(t, 0, bufcap))
		val.SetLen(bufcap)
	case reflect.Map:
		val = reflect.New(t).Elem()
		val.Set(reflect.MakeMap(t))
	default:
		val = reflect.New(t).Elem()
	}
	return
}