// GetEntity returns all the availble attributes for a single entity (user, content, etc)
// https://learn.lytics.com/api-docs/personalization
424573
func (l *Client) GetEntityParams(entitytype, fieldname, fieldval string, fields []string, params url.Values) (*Entity, error) {
	res := ApiResp{}
	data := Entity{}
	entFields := make(map[string]interface{})
	toAppend := ""
	endpointParams := map[string]string{}

	// handle optional endpointParams
	if entitytype == "" {
		entitytype = "user"
	}

	toAppend = fmt.Sprintf("/%s", ":entitytype")
	endpointParams["entitytype"] = entitytype

	if fieldname != "" {
		toAppend = fmt.Sprintf("%s/%s", toAppend, ":fieldname")
		endpointParams["fieldname"] = fieldname

		if fieldval != "" {
			toAppend = fmt.Sprintf("%s/%s", toAppend, ":fieldval")
			endpointParams["fieldval"] = fieldval
		}
	}
	// build dynamic endpoint
	endpoint := fmt.Sprintf("%s%s", entityEndpoint, toAppend)

	// if there are also fields, add them
	if len(fields) > 0 {
		params.Add("fields", strings.Join(fields, ","))
	}

	// make the request
	entityUrl := parseLyticsURL(endpoint, endpointParams)
	err := l.Get(entityUrl, params, nil, &res, &entFields)
	if err != nil {
		return nil, err
	}
	data.Meta = res.Meta
	data.Fields = entFields
	return &data, nil
}
710500
func (c *Client) GetUser(userID string) (*User, error) {
	uri := fmt.Sprintf("/1/users/%s", userID)
	resp, err := c.doSimple("GET", uri)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}
	c.trace("GetUser", uri, string(body))
	var user *User
	// TODO(tmc): warn if not == .Zero() before populating?
	return user, json.Unmarshal(body, &user)
}
1137922
func (c *Client) Get(tags []string) ([]params.AnnotationsGetResult, error) {
	annotations := params.AnnotationsGetResults{}
	if err := c.facade.FacadeCall("Get", entitiesFromTags(tags), &annotations); err != nil {
		return annotations.Results, errors.Trace(err)
	}
	return annotations.Results, nil
}
965031
func (c *Connector) GetEntitySchema(ctx context.Context, scope, namePrefix, entityName string, version int32) (*dosa.EntityDefinition, error) {
	return &dosa.EntityDefinition{}, nil
}
636401
func (b *BigIP) getForEntity(e interface{}, path ...string) (error, bool) {
	req := &APIRequest{
		Method:      "get",
		URL:         b.iControlPath(path),
		ContentType: "application/json",
	}

	resp, err := b.APICall(req)
	if err != nil {
		var reqError RequestError
		json.Unmarshal(resp, &reqError)
		if reqError.Code == 404 {
			return nil, false
		}
		return err, false
	}

	err = json.Unmarshal(resp, e)
	if err != nil {
		return err, false
	}

	return nil, true
}
790220
func (s *ConfigService) get(_ *restful.Request, resp *restful.Response) {
	cfg := s.ApiCfg()
	ent := &ConfigEntity{
		Signup: Signup{
			Disable: cfg.Signup.Disable,
		},
	}
	if cfg.Raven != "" {
		ent.Raven.Enable = true
		ent.Raven.Address = cfg.Raven
	}
	if cfg.GA != "" {
		ent.GA.Enable = true
		ent.GA.Id = cfg.GA
	}
	resp.WriteEntity(ent)
}
512262
func GetAtt(ref, attr interface{}) interface{} {
	switch v := ref.(type) {
	case NamedResource:
		ref = v.Name
	}
	return map[string][]interface{}{"Fn::GetAtt": []interface{}{ref, attr}}
}
72370
func (m *Model) getEntityRefs() (*modelEntityRefsDoc, error) {
	modelEntityRefs, closer := m.st.db().GetCollection(modelEntityRefsC)
	defer closer()

	var doc modelEntityRefsDoc
	if err := modelEntityRefs.FindId(m.UUID()).One(&doc); err != nil {
		if err == mgo.ErrNotFound {
			return nil, errors.NotFoundf("entity references doc for model %s", m.UUID())
		}
		return nil, errors.Annotatef(err, "getting entity references for model %s", m.UUID())
	}
	return &doc, nil
}
797030
func (c *FakeUserIdentityMappings) Get(name string, options v1.GetOptions) (result *user.UserIdentityMapping, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootGetAction(useridentitymappingsResource, name), &user.UserIdentityMapping{})
	if obj == nil {
		return nil, err
	}
	return obj.(*user.UserIdentityMapping), err
}
1269891
func (vrsConnection *VRSConnection) CreateEntity(info EntityInfo) error {

	if len(info.UUID) == 0 {
		return fmt.Errorf("Uuid absent")
	}

	if len(info.Name) == 0 {
		return fmt.Errorf("Name absent")
	}

	// The Nuage_VM_Table has separate columns for enterprise and user.
	// Hence make a copy of the metadata and delete these keys.
	var metadata map[string]string
	if info.Metadata != nil {
		metadata = make(map[string]string)
		for k, v := range info.Metadata {
			metadata[string(k)] = v
		}
	}
	//delete(metadata, string(entity.MetadataKeyEnterprise))
	delete(metadata, string(entity.MetadataKeyUser))

	nuageVMTableRow := ovsdb.NuageVMTableRow{
		Type:            int(info.Type),
		VMName:          info.Name,
		VMUuid:          info.UUID,
		Domain:          info.Domain,
		NuageUser:       info.Metadata[entity.MetadataKeyUser],
		NuageEnterprise: info.Metadata[entity.MetadataKeyEnterprise],
		Metadata:        metadata,
		Ports:           info.Ports,
		Event:           int(entity.EventCategoryDefined),
		EventType:       int(entity.EventDefinedAdded),
		State:           int(entity.Running),
		Reason:          int(entity.RunningUnknown),
	}

	if info.Events != nil {
		nuageVMTableRow.Event = int(info.Events.EntityEventCategory)
		nuageVMTableRow.EventType = int(info.Events.EntityEventType)
		nuageVMTableRow.State = int(info.Events.EntityState)
		nuageVMTableRow.Reason = int(info.Events.EntityReason)
	}

	if err := vrsConnection.vmTable.InsertRow(vrsConnection.ovsdbClient, &nuageVMTableRow); err != nil {
		return fmt.Errorf("Problem adding entity info to VRS %v", err)
	}

	return nil
}
410351
func GetUser(req *restful.Request) *user.User {
	raw := req.Attribute(AttrUserKey)
	if raw == nil {
		panic("GetUser attribute is nil")
	}
	u, ok := raw.(*user.User)
	if !ok {
		panic(fmt.Sprintf("GetUser attribute isn't a user type, but %#v", raw))
	}
	return u
}
90665
func (a *Client) GetIdentity(params *GetIdentityParams) (*GetIdentityOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetIdentityParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "GetIdentity",
		Method:             "GET",
		PathPattern:        "/identity",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetIdentityReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetIdentityOK), nil

}
1195851
func (r *Response) GetAttribute(name string) string {
	for _, attr := range r.Assertion.AttributeStatement.Attributes {
		if attr.Name == name || attr.FriendlyName == name {
			return attr.AttributeValues[0].Value
		}
	}
	return ""
}
869847
func (vpcOfferingApi *VpcOfferingApi) Get(id string) (*VpcOffering, error) {
	data, err := vpcOfferingApi.entityService.Get(id, map[string]string{})
	if err != nil {
		return nil, err
	}
	return parseVpcOffering(data), nil
}
738292
func (cache *charmstoreEntityCache) GetResource(name string) (resource.Resource, error) {
	return cache.st.GetResource(cache.applicationID, name)
}
395145
func GetEntityGroupVersion(c context.Context, key *ds.Key) (int64, error) {
	egm := &EntityGroupMeta{Parent: key.Root()}
	err := ds.Get(c, egm)
	ret := egm.Version
	if err == ds.ErrNoSuchEntity {
		// this is OK for callers. The version of the entity group is effectively 0
		// in this case.
		err = nil
	}
	return ret, err
}
1000402
func GetEntities(pgpKeys []string) ([]*openpgp.Entity, error) {
	ret := make([]*openpgp.Entity, 0, len(pgpKeys))
	for _, keystring := range pgpKeys {
		data, err := base64.StdEncoding.DecodeString(keystring)
		if err != nil {
			return nil, errwrap.Wrapf("error decoding given PGP key: {{err}}", err)
		}
		entity, err := openpgp.ReadEntity(packet.NewReader(bytes.NewBuffer(data)))
		if err != nil {
			return nil, errwrap.Wrapf("error parsing given PGP key: {{err}}", err)
		}
		ret = append(ret, entity)
	}
	return ret, nil
}