// TODO: Add a means to set/update more than just the hard threshold
// SetIsiQuotaHardThreshold sets the hard threshold of a quota for a directory
776745
func SetIsiQuotaHardThreshold(
	ctx context.Context,
	client api.Client,
	path string, size int64) (err error) {

	// PAPI call: POST https://1.2.3.4:8080/platform/1/quota/quotas
	//             { "enforced" : true,
	//               "include_snapshots" : false,
	//               "path" : "/ifs/volumes/volume_name",
	//               "thresholds_include_overhead" : false,
	//               "type" : "directory",
	//               "thresholds" : { "advisory" : null,
	//                                "hard" : 1234567890,
	//                                "soft" : null
	//                              }
	//             }
	var data = &IsiQuotaReq{
		Enforced:         true,
		IncludeSnapshots: false,
		Path:             path,
		ThresholdsIncludeOverhead: false,
		Type:       "directory",
		Thresholds: isiThresholdsReq{Advisory: nil, Hard: size, Soft: nil},
	}

	var quotaResp IsiQuota
	err = client.Post(ctx, quotaPath, "", nil, nil, data, &quotaResp)
	return err
}
432157
func parseThreshold(threshold string) (min float64, max float64, err error) {
	thresh := strings.Split(threshold, ":")
	switch len(thresh) {
	case 1:
		max, err = strconv.ParseFloat(string(thresh[0]), 64)
		if err != nil {
			return 0, 0, ErrBadThresholdFormat
		}

		return 0, max, nil
	case 2:
		if thresh[0] == "~" {
			min = MinFloat64
		} else {
			min, err = strconv.ParseFloat(string(thresh[0]), 64)
			if err != nil {
				min = 0
			}
		}

		if thresh[1] == "" {
			max = MaxFloat64
		} else {
			max, err = strconv.ParseFloat(string(thresh[1]), 64)
			if err != nil {
				return 0, 0, ErrBadThresholdFormat
			}
		}
	default:
		return 0, 0, ErrBadThresholdFormat
	}

	return
}
41367
func (client *Client) SetLoadBalancerUDPListenerAttribute(args *SetLoadBalancerUDPListenerAttributeArgs) (err error) {
	response := &CommonLoadBalancerListenerResponse{}
	err = client.Invoke("SetLoadBalancerUDPListenerAttribute", args, response)
	return err
}
240448
func (s *CreateModelPackageInput) SetSourceAlgorithmSpecification(v *SourceAlgorithmSpecification) *CreateModelPackageInput {
	s.SourceAlgorithmSpecification = v
	return s
}
168734
func (actor Actor) SetSpaceQuota(spaceGUID, quotaGUID string) (Warnings, error) {
	warnings, err := actor.CloudControllerClient.SetSpaceQuota(spaceGUID, quotaGUID)
	return Warnings(warnings), err
}
976407
func (p *nfsProvisioner) createQuota(directory string, capacity resource.Quantity) (string, uint16, error) {
	path := path.Join(p.exportDir, directory)

	limit := strconv.FormatInt(capacity.Value(), 10)

	block, projectID, err := p.quotaer.AddProject(path, limit)
	if err != nil {
		return "", 0, fmt.Errorf("error adding project for path %s: %v", path, err)
	}

	err = p.quotaer.SetQuota(projectID, path, limit)
	if err != nil {
		p.quotaer.RemoveProject(block, projectID)
		return "", 0, fmt.Errorf("error setting quota for path %s: %v", path, err)
	}

	return block, projectID, nil
}
838612
func (s *DirectoryLimits) SetCloudOnlyDirectoriesLimitReached(v bool) *DirectoryLimits {
	s.CloudOnlyDirectoriesLimitReached = &v
	return s
}
237523
func SetQuota(qr quota.QuotaRequest) *master.Call {
	return &master.Call{
		Type: master.Call_SET_QUOTA,
		SetQuota: &master.Call_SetQuota{
			QuotaRequest: qr,
		},
	}
}
181629
func (s *InputLossBehavior) SetInputLossImageSlate(v *InputLocation) *InputLossBehavior {
	s.InputLossImageSlate = v
	return s
}
401107
func (j *Journal) SetDataThreshold(threshold uint64) error {
	sd_journal_set_data_threshold, err := getFunction("sd_journal_set_data_threshold")
	if err != nil {
		return err
	}

	j.mu.Lock()
	r := C.my_sd_journal_set_data_threshold(sd_journal_set_data_threshold, j.cjournal, C.size_t(threshold))
	j.mu.Unlock()

	if r < 0 {
		return fmt.Errorf("failed to set data threshold: %d", syscall.Errno(-r))
	}

	return nil
}
898935
func (wr *Wrangler) SetShardIsMasterServing(ctx context.Context, keyspace, shard string, isMasterServing bool) (err error) {
	// lock the keyspace to not conflict with resharding operations
	ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, fmt.Sprintf("SetShardIsMasterServing(%v,%v,%v)", keyspace, shard, isMasterServing))
	if lockErr != nil {
		return lockErr
	}
	defer unlock(&err)

	// and update the shard
	_, err = wr.ts.UpdateShardFields(ctx, keyspace, shard, func(si *topo.ShardInfo) error {
		si.IsMasterServing = isMasterServing
		return nil
	})
	return err
}
790208
func (tsv *TabletServer) SetQueryPoolWaiterCap(val int64) {
	tsv.qe.queryPoolWaiterCap.Set(val)
}
129134
func UpdateQuota(c context.Context, limit, usage float64, metric, project, region string) {
	quotaLimit.Set(c, limit, metric, project, region)
	quotaRemaining.Set(c, limit-usage, metric, project, region)
	quotaUsage.Set(c, usage, metric, project, region)
}
824634
func (s *UpdateTrailOutput) SetIsOrganizationTrail(v bool) *UpdateTrailOutput {
	s.IsOrganizationTrail = &v
	return s
}
600016
func (s *PutScalingPolicyInput) SetThreshold(v float64) *PutScalingPolicyInput {
	s.Threshold = &v
	return s
}
274713
func (l *Logger) SetThresholdByName(n string) error {
	var level int
	switch n {
	case "critical", "crit":
		level = LvCritical
	case "error":
		level = LvError
	case "warning", "warn":
		level = LvWarn
	case "information", "info":
		level = LvInfo
	case "debug":
		level = LvDebug
	default:
		return fmt.Errorf("No such level: %s", n)
	}
	l.SetThreshold(level)
	return nil
}
1097343
func (s *UsagePlan) SetQuota(v *QuotaSettings) *UsagePlan {
	s.Quota = v
	return s
}