// GetProducts gets products associated with a contract
550585
func (contract *Contract) GetProducts() (*Products, error) {
	req, err := client.NewRequest(
		Config,
		"GET",
		fmt.Sprintf(
			"/papi/v1/products?contractId=%s",
			contract.ContractID,
		),
		nil,
	)
	if err != nil {
		return nil, err
	}

	res, err := client.Do(Config, req)
	if err != nil {
		return nil, err
	}

	if client.IsError(res) {
		return nil, client.NewAPIError(res)
	}

	products := NewProducts()
	if err = client.BodyJSON(res, products); err != nil {
		return nil, err
	}

	return products, nil
}
237097
func SetProduct(sets ...cty.Value) (cty.Value, error) {
	return SetProductFunc.Call(sets)
}
114881
func (indexRef *IndexReference) GetProductsPath(cons LookupConstraint) (string, error) {
	if indexRef.MirroredProductsPath != "" {
		return indexRef.MirroredProductsPath, nil
	}
	prodIds, err := cons.ProductIds()
	if err != nil {
		return "", err
	}
	candidates := indexRef.extractIndexes(cons.IndexIds())
	// Restrict to the relevant data type entries.
	dataTypeMatches := func(metadata *IndexMetadata) bool {
		return metadata.DataType == indexRef.valueParams.DataType
	}
	candidates = candidates.filter(dataTypeMatches)
	if len(candidates) == 0 {
		// TODO: jam 2015-04-01 This isn't a great error to use,
		// because it is generally reserved for file-not-found
		// semantics.
		// This was formatted as: index file missing "content-download" data not found
		// It now formats as: "content-download" data not found
		// which at least reads better.
		// Shouldn't we be using noMatchingProductsError instead?
		return "", errors.NotFoundf("%q data", indexRef.valueParams.DataType)
	}
	// Restrict by cloud spec, if required.
	if cons.Params().CloudSpec != EmptyCloudSpec {
		hasRightCloud := func(metadata *IndexMetadata) bool {
			return metadata.hasCloud(cons.Params().CloudSpec)
		}
		candidates = candidates.filter(hasRightCloud)
		if len(candidates) == 0 {
			return "", errors.NotFoundf("index file has no data for cloud %v", cons.Params().CloudSpec)
		}
	}
	// Restrict by product IDs.
	hasProduct := func(metadata *IndexMetadata) bool {
		return metadata.hasProduct(prodIds)
	}
	candidates = candidates.filter(hasProduct)
	if len(candidates) == 0 {
		return "", newNoMatchingProductsError("index file has no data for product name(s) %q", prodIds)
	}

	logger.Tracef("candidate matches for products %q are %v", prodIds, candidates)

	// Pick arbitrary match.
	return candidates[0].ProductsFilePath, nil
}
839367
func (c Client) GetProperties(name string) (bool, map[string]string, error) {
	nameExists, err := c.nameExists(name)
	if err != nil {
		return false, nil, err
	}

	if !nameExists {
		return false, nil, nil
	}

	properties := make(map[string]string)

	var continueToken string
	for {
		res, err := c.getHTTP("Names/"+name+"/$/GetProperties", withContinue(continueToken), withParam("IncludeValues", "true"))
		if err != nil {
			return false, nil, err
		}

		var propertiesListPage PropertiesListPage
		err = json.Unmarshal(res, &propertiesListPage)
		if err != nil {
			return false, nil, fmt.Errorf("could not deserialise JSON response: %+v", err)
		}

		for _, property := range propertiesListPage.Properties {
			if property.Value.Kind != "String" {
				continue
			}
			properties[property.Name] = property.Value.Data
		}

		continueToken = propertiesListPage.ContinuationToken
		if continueToken == "" {
			break
		}
	}

	return true, properties, nil
}
964492
func (r Product_Promotion) FindByPromoCode(code *string) (resp datatypes.Container_Product_Promotion, err error) {
	params := []interface{}{
		code,
	}
	err = r.Session.DoRequest("SoftLayer_Product_Promotion", "findByPromoCode", params, &r.Options, &resp)
	return
}
333569
func (p *PolyKernel) InnerProduct(vectorX *mat.Dense, vectorY *mat.Dense) float64 {
	subVectorX := vectorX.ColView(0)
	subVectorY := vectorY.ColView(0)
	result := mat.Dot(subVectorX, subVectorY)
	result = math.Pow(result+1, float64(p.degree))

	return result
}
147504
func (contracts *Contracts) GetContracts() error {
	req, err := client.NewRequest(
		Config,
		"GET",
		"/papi/v1/contracts",
		nil,
	)
	if err != nil {
		return err
	}

	res, err := client.Do(Config, req)
	if err != nil {
		return err
	}

	if client.IsError(res) {
		return client.NewAPIError(res)
	}

	if err = client.BodyJSON(res, contracts); err != nil {
		return err
	}

	if err != nil {
		return err
	}

	return nil
}
317902
func (v *Service) GetFunctions() (o []*Function) {
	if v != nil {
		o = v.Functions
	}
	return
}
166260
func (l *License) GetConditions() []string {
	if l == nil || l.Conditions == nil {
		return nil
	}
	return *l.Conditions
}
1075650
func (group *Group) GetProperties(contract *Contract) (*Properties, error) {
	return GetProperties(contract, group)
}
365224
func (s *Products) GetPropertyValues(job Jobs, identifier string) (propertyMap map[string]string) {
	properties := job.Properties
	propertyMap = make(map[string]string)
	for _, property := range properties {

		if property.Identifier == identifier {
			for key, value := range property.Value.MapValue {
				propertyMap[key] = fmt.Sprintf("%v", value)
			}
		}
	}
	return
}
980877
func (api *Client) GetReactions(item ItemRef, params GetReactionsParameters) ([]ItemReaction, error) {
	return api.GetReactionsContext(context.Background(), item, params)
}
468529
func (s *Products) GetPropertiesByJob(jobname string) (properties []Properties, err error) {
	var job Jobs
	job, err = s.GetJob(jobname)
	if err != nil {
		return
	}
	properties = job.Properties
	return
}
1316833
func (products *Products) FindProduct(id string) (*Product, error) {
	var product *Product
	var productFound bool
	for _, product = range products.Products.Items {
		if product.ProductID == id {
			productFound = true
			break
		}
	}

	if !productFound {
		return nil, fmt.Errorf("Unable to find product: \"%s\"", id)
	}

	return product, nil
}
1246284
func (properties *Properties) GetProperties(contract *Contract, group *Group) error {
	if contract == nil {
		contract = NewContract(NewContracts())
		contract.ContractID = group.ContractIDs[0]
	}

	req, err := client.NewRequest(
		Config,
		"GET",
		fmt.Sprintf(
			"/papi/v1/properties?groupId=%s&contractId=%s",
			group.GroupID,
			contract.ContractID,
		),
		nil,
	)

	if err != nil {
		return err
	}

	res, err := client.Do(Config, req)

	if client.IsError(res) {
		return client.NewAPIError(res)
	}

	if err = client.BodyJSON(res, properties); err != nil {
		return err
	}

	return nil
}
322157
func NewProductDiskAPI(client *Client) *ProductDiskAPI {
	return &ProductDiskAPI{
		&baseAPI{
			client: client,
			FuncGetResourceURL: func() string {
				return "product/disk"
			},
		},
	}
}
1070260
func GetProperties(required bool) (*Properties, error) {
	filename := flag.String("props", "", "properties filename")
	flag.Parse()
	if *filename == "" {
		if required {
			return nil, NO_PROPS_FILE
		} else {
			return &Properties{make(map[string]string)}, nil
		}
	}
	return readPropertiesFile(*filename)
}