// ConvertTypeGroup converts WorkitemTypeGroup model to a response resource
// object for jsonapi.org specification
763434
func ConvertTypeGroup(request *http.Request, tg workitem.WorkItemTypeGroup) *app.WorkItemTypeGroupData {
	workitemtypes := "workitemtypes"
	workItemTypeGroupRelatedURL := rest.AbsoluteURL(request, app.WorkItemTypeGroupHref(tg.ID))
	createdAt := tg.CreatedAt.UTC()
	updatedAt := tg.UpdatedAt.UTC()
	// Every work item type group except the one in the "iteration" bucket are
	// meant to be shown in the sidebar.
	showInSidebar := (tg.Bucket != workitem.BucketIteration)

	res := &app.WorkItemTypeGroupData{
		ID:   &tg.ID,
		Type: APIWorkItemTypeGroups,
		Links: &app.GenericLinks{
			Related: &workItemTypeGroupRelatedURL,
		},
		Attributes: &app.WorkItemTypeGroupAttributes{
			Bucket:        tg.Bucket.String(),
			Name:          tg.Name,
			Description:   tg.Description,
			Icon:          tg.Icon,
			CreatedAt:     &createdAt,
			UpdatedAt:     &updatedAt,
			ShowInSidebar: &showInSidebar,
		},
		Relationships: &app.WorkItemTypeGroupRelationships{
			TypeList: &app.RelationGenericList{
				Data: make([]*app.GenericData, len(tg.TypeList)),
			},
			SpaceTemplate: &app.RelationGeneric{
				Data: &app.GenericData{
					ID:   ptr.String(tg.SpaceTemplateID.String()),
					Type: &APISpaceTemplates,
				},
			},
		},
	}

	for i, witID := range tg.TypeList {
		// witRelatedURL := rest.AbsoluteURL(request, app.WorkitemtypeHref(space.SystemSpace, witID))
		idStr := witID.String()
		res.Relationships.TypeList.Data[i] = &app.GenericData{
			ID:   &idStr,
			Type: &workitemtypes,
			// Links: &app.GenericLinks{
			// Related: &witRelatedURL,
			// },
		}
	}
	return res
}
512435
func ConvertWorkItemLinkTypeFromModel(request *http.Request, modelLinkType link.WorkItemLinkType) app.WorkItemLinkTypeSingle {
	spaceTemplateRelatedURL := rest.AbsoluteURL(request, app.SpaceTemplateHref(modelLinkType.SpaceTemplateID.String()))
	spaceRelatedURL := rest.AbsoluteURL(request, app.SpaceHref(space.SystemSpace.String()))

	topologyStr := modelLinkType.Topology.String()
	var converted = app.WorkItemLinkTypeSingle{
		Data: &app.WorkItemLinkTypeData{
			Type: link.EndpointWorkItemLinkTypes,
			ID:   &modelLinkType.ID,
			Attributes: &app.WorkItemLinkTypeAttributes{
				Name:               &modelLinkType.Name,
				Description:        modelLinkType.Description,
				Version:            &modelLinkType.Version,
				CreatedAt:          &modelLinkType.CreatedAt,
				UpdatedAt:          &modelLinkType.UpdatedAt,
				ForwardName:        &modelLinkType.ForwardName,
				ForwardDescription: modelLinkType.ForwardDescription,
				ReverseName:        &modelLinkType.ReverseName,
				ReverseDescription: modelLinkType.ReverseDescription,
				Topology:           &topologyStr,
			},
			Relationships: &app.WorkItemLinkTypeRelationships{
				Space:         app.NewSpaceRelation(space.SystemSpace, spaceRelatedURL),
				SpaceTemplate: app.NewSpaceTemplateRelation(modelLinkType.SpaceTemplateID, spaceTemplateRelatedURL),
			},
		},
	}
	return converted
}
418986
func Convert_v1alpha1_InstanceGroup_To_kops_InstanceGroup(in *InstanceGroup, out *kops.InstanceGroup, s conversion.Scope) error {
	return autoConvert_v1alpha1_InstanceGroup_To_kops_InstanceGroup(in, out, s)
}
878378
func (v *versionConverter) Convert(object typed.TypedValue, version fieldpath.APIVersion) (typed.TypedValue, error) {
	// Convert the smd typed value to a kubernetes object.
	objectToConvert, err := v.typeConverter.TypedToObject(object)
	if err != nil {
		return object, err
	}

	// Parse the target groupVersion.
	groupVersion, err := schema.ParseGroupVersion(string(version))
	if err != nil {
		return object, err
	}

	// If attempting to convert to the same version as we already have, just return it.
	fromVersion := objectToConvert.GetObjectKind().GroupVersionKind().GroupVersion()
	if fromVersion == groupVersion {
		return object, nil
	}

	// Convert to internal
	internalObject, err := v.objectConvertor.ConvertToVersion(objectToConvert, v.hubGetter(fromVersion))
	if err != nil {
		return object, err
	}

	// Convert the object into the target version
	convertedObject, err := v.objectConvertor.ConvertToVersion(internalObject, groupVersion)
	if err != nil {
		return object, err
	}

	// Convert the object back to a smd typed value and return it.
	return v.typeConverter.ObjectToTyped(convertedObject)
}
118378
func ConvertToGVK(obj runtime.Object, gvk schema.GroupVersionKind, o admission.ObjectInterfaces) (runtime.Object, error) {
	// Unlike other resources, custom resources do not have internal version, so
	// if obj is a custom resource, it should not need conversion.
	if obj.GetObjectKind().GroupVersionKind() == gvk {
		return obj, nil
	}
	out, err := o.GetObjectCreater().New(gvk)
	if err != nil {
		return nil, err
	}
	err = o.GetObjectConvertor().Convert(obj, out, nil)
	if err != nil {
		return nil, err
	}
	// Explicitly set the GVK
	out.GetObjectKind().SetGroupVersionKind(gvk)
	return out, nil
}
391253
func (disabledGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersionKind) (schema.GroupVersionKind, bool) {
	return schema.GroupVersionKind{}, false
}
1157085
func (r Product_Package_Preset) GetComputeGroup() (resp datatypes.Product_Item_Server_Group, err error) {
	err = r.Session.DoRequest("SoftLayer_Product_Package_Preset", "getComputeGroup", nil, &r.Options, &resp)
	return
}
458447
func (i *Image) Convert(t ImageType) ([]byte, error) {
	options := Options{Type: t}
	return i.Process(options)
}
714340
func (client *Client) CreateScalingGroup(args *CreateScalingGroupArgs) (resp *CreateScalingGroupResponse, err error) {
	response := CreateScalingGroupResponse{}
	err = client.InvokeByFlattenMethod("CreateScalingGroup", args, &response)

	if err != nil {
		return nil, err
	}
	return &response, nil
}
380633
func (r *GormWorkItemTypeGroupRepository) loadTypeList(ctx context.Context, groupID uuid.UUID) ([]uuid.UUID, error) {
	members := []typeGroupMember{}
	db := r.db.Model(&members).Where("type_group_id=?", groupID).Order("position ASC").Find(&members)
	if db.RecordNotFound() {
		log.Error(ctx, map[string]interface{}{"witg_id": groupID}, "work item type group members not found")
		return nil, errors.NewNotFoundError("work item type group members of group", groupID.String())
	}
	if err := db.Error; err != nil {
		return nil, errors.NewInternalError(ctx, err)
	}
	res := make([]uuid.UUID, len(members))
	for i, member := range members {
		res[i] = member.WorkItemTypeID
	}
	return res, nil
}
977525
func (cm compressionTypeMask) toType() CompressionType {

	switch cm {
	case compressionTypeV1Mask:
		return CompressionTypeV1
	case compressionTypeV2Mask:
		return CompressionTypeV2
	default:
		return CompressionTypeNone
	}
}
880083
func convertToGoType(tip, items string) string {
	// check for raml builtin type
	if v, ok := typeMap[tip]; ok {
		return v
	}

	if v := mapDate(tip); v != "" {
		return v
	}

	// creates raml.Type object for this type,
	// so we can use raml.Type methods
	ramlType := raml.Type{
		Type:  tip,
		Items: items,
	}

	// other types that need some processing
	switch {
	case ramlType.IsBidimensiArray():
		return "[][]" + ramlType.BidimensiArrayType()
	case ramlType.IsArray():
		return "[]" + convertToGoType(ramlType.ArrayType(), "")
	case ramlType.IsUnion():
		return unionNewName(tip)
	case ramlType.IsMultipleInheritance():
		parents, _ := ramlType.MultipleInheritance()
		return multipleInheritanceNewName(parents)
	}
	return commons.NormalizePkgName(tip)
}
348597
func NewWorkItemTypeGroupsController(service *goa.Service, db application.DB) *WorkItemTypeGroupsController {
	return &WorkItemTypeGroupsController{
		Controller: service.NewController("WorkItemTypeGroupsController"),
		db:         db,
	}
}
1069224
func Convert_v1alpha1_GroupResource_To_v1_GroupResource(in *v1alpha1.GroupResource, out *v1.GroupResource, s conversion.Scope) error {
	return autoConvert_v1alpha1_GroupResource_To_v1_GroupResource(in, out, s)
}
640386
func (obj *TypeMeta) GroupVersionKind() schema.GroupVersionKind {
	return schema.FromAPIVersionAndKind(obj.APIVersion, obj.Kind)
}
408565
func Convert(r io.Reader, mimeType string, readability bool) (*Response, error) {
	start := time.Now()

	var body string
	var meta map[string]string
	var err error
	switch mimeType {
	case "application/msword", "application/vnd.ms-word":
		body, meta, err = ConvertDoc(r)

	case "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
		body, meta, err = ConvertDocx(r)

	case "application/vnd.oasis.opendocument.text":
		body, meta, err = ConvertODT(r)

	case "application/vnd.apple.pages", "application/x-iwork-pages-sffpages":
		body, meta, err = ConvertPages(r)

	case "application/pdf":
		body, meta, err = ConvertPDF(r)

	case "application/rtf", "application/x-rtf", "text/rtf", "text/richtext":
		body, meta, err = ConvertRTF(r)

	case "text/html":
		body, meta, err = ConvertHTML(r, readability)

	case "text/url":
		body, meta, err = ConvertURL(r, readability)

	case "text/xml", "application/xml":
		body, meta, err = ConvertXML(r)

	case "image/jpeg", "image/png", "image/tif", "image/tiff":
		body, meta, err = ConvertImage(r)

	case "text/plain":
		var b []byte
		b, err = ioutil.ReadAll(r)
		body = string(b)
	}

	if err != nil {
		return nil, fmt.Errorf("error converting data: %v", err)
	}

	return &Response{
		Body:  strings.TrimSpace(body),
		Meta:  meta,
		MSecs: uint32(time.Since(start) / time.Millisecond),
	}, nil
}
124559
func NewGroupChangeExternalIdType(Description string) *GroupChangeExternalIdType {
	s := new(GroupChangeExternalIdType)
	s.Description = Description
	return s
}