// GetPlan プラン取得(デフォルト: 1000cps)
776450
func (p *ProxyLB) GetPlan() ProxyLBPlan {
	classes := strings.Split(p.ServiceClass, "/")
	class, err := strconv.Atoi(classes[len(classes)-1])
	if err != nil {
		return ProxyLBPlan1000
	}
	return ProxyLBPlan(class)
}
840619
func (api *API) AvailableZonePlans(zoneID string) ([]ZonePlan, error) {
	uri := "/zones/" + zoneID + "/available_plans"
	res, err := api.makeRequest("GET", uri, nil)
	if err != nil {
		return []ZonePlan{}, errors.Wrap(err, errMakeRequestError)
	}
	var r AvailableZonePlansResponse
	err = json.Unmarshal(res, &r)
	if err != nil {
		return []ZonePlan{}, errors.Wrap(err, errUnmarshalError)
	}
	return r.Result, nil
}
295469
func (client *Client) GetServicePlan(servicePlanGUID string) (ServicePlan, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetServicePlanRequest,
		URIParams:   Params{"service_plan_guid": servicePlanGUID},
	})
	if err != nil {
		return ServicePlan{}, nil, err
	}

	var servicePlan ServicePlan
	response := cloudcontroller.Response{
		DecodeJSONResponseInto: &servicePlan,
	}

	err = client.connection.Make(request, &response)
	return servicePlan, response.Warnings, err
}
237415
func (api *NFSAPI) GetNFSPlans() (*sacloud.NFSPlans, error) {
	notes, err := api.client.Note.Reset().Find()
	if err != nil {
		return nil, err
	}
	for _, note := range notes.Notes {
		if note.Class == sacloud.ENoteClass("json") && note.Name == "sys-nfs" {
			rawPlans := note.Content

			var plans struct {
				Plans *sacloud.NFSPlans `json:"plans"`
			}

			err := json.Unmarshal([]byte(rawPlans), &plans)
			if err != nil {
				return nil, err
			}

			return plans.Plans, nil
		}
	}

	return nil, nil
}
320963
func (p NFSPlans) FindByPlanID(planID int64) (NFSPlan, *NFSPlanValue) {

	for _, plan := range p.SSD {
		id, err := plan.PlanID.Int64()
		if err != nil {
			continue
		}
		if id == planID {
			return NFSPlanSSD, &plan
		}
	}

	for _, plan := range p.HDD {
		id, err := plan.PlanID.Int64()
		if err != nil {
			continue
		}
		if id == planID {
			return NFSPlanHDD, &plan
		}
	}
	return NFSPlan(-1), nil
}
1276764
func (a *ExecStmt) RebuildPlan() (int64, error) {
	is := GetInfoSchema(a.Ctx)
	a.InfoSchema = is
	if err := plannercore.Preprocess(a.Ctx, a.StmtNode, is, plannercore.InTxnRetry); err != nil {
		return 0, err
	}
	p, err := planner.Optimize(a.Ctx, a.StmtNode, is)
	if err != nil {
		return 0, err
	}
	a.Plan = p
	return is.SchemaMetaVersion(), nil
}
627317
func (p *Sort) convert2PhysicalPlan(prop *requiredProperty) (*physicalPlanInfo, error) {
	info, err := p.getPlanInfo(prop)
	if err != nil {
		return nil, errors.Trace(err)
	}
	if info != nil {
		return info, nil
	}
	selfProp := &requiredProperty{
		props: make([]*columnProp, 0, len(p.ByItems)),
	}
	for _, by := range p.ByItems {
		if col, ok := by.Expr.(*expression.Column); ok {
			selfProp.props = append(selfProp.props, &columnProp{col: col, desc: by.Desc})
		} else {
			selfProp.props = nil
			break
		}
	}
	selfProp.sortKeyLen = len(selfProp.props)
	if len(selfProp.props) != 0 && len(prop.props) == 0 && prop.limit != nil {
		selfProp.limit = prop.limit
	}
	sortedPlanInfo, err := p.GetChildByIndex(0).(LogicalPlan).convert2PhysicalPlan(selfProp)
	if err != nil {
		return nil, errors.Trace(err)
	}
	unSortedPlanInfo, err := p.GetChildByIndex(0).(LogicalPlan).convert2PhysicalPlan(&requiredProperty{})
	if err != nil {
		return nil, errors.Trace(err)
	}
	sortCost := sortCost(unSortedPlanInfo.count)
	if len(selfProp.props) == 0 {
		np := p.Copy().(*Sort)
		np.ExecLimit = prop.limit
		sortedPlanInfo = addPlanToResponse(np, sortedPlanInfo)
	} else if sortCost+unSortedPlanInfo.cost < sortedPlanInfo.cost {
		sortedPlanInfo.cost = sortCost + unSortedPlanInfo.cost
		np := *p
		np.ExecLimit = selfProp.limit
		sortedPlanInfo = addPlanToResponse(&np, unSortedPlanInfo)
	}
	if !matchProp(p.ctx, prop, selfProp) {
		sortedPlanInfo.cost = math.MaxFloat64
	}
	p.storePlanInfo(prop, sortedPlanInfo)
	return sortedPlanInfo, nil
}
1048802
func (c *Client) AvailLinodePlans(planID *int) ([]LinodePlan, error) {
	args := make(map[string]interface{})
	args["PlanID"] = planID

	data, err := c.apiCall("avail.linodeplans", args)
	if err != nil {
		return nil, err
	}

	var ret []LinodePlan
	err = json.Unmarshal(data, &ret)
	if err != nil {
		return nil, err
	}

	return ret, nil
}
1249363
func (t *AvailService) LinodePlans() (*LinodePlansResponse, error) {
	u := &url.Values{}
	v := LinodePlansResponse{}
	if err := t.client.do("avail.linodeplans", u, &v.Response); err != nil {
		return nil, err
	}
	v.LinodePlans = make([]LinodePlan, 5)
	if err := json.Unmarshal(v.RawData, &v.LinodePlans); err != nil {
		return nil, err
	}
	return &v, nil
}
988840
func (m *MarketplacePlan) GetAccountsURL() string {
	if m == nil || m.AccountsURL == nil {
		return ""
	}
	return *m.AccountsURL
}
479608
func (t *Template) GetAllAWSAutoScalingPlansScalingPlanResources() map[string]*resources.AWSAutoScalingPlansScalingPlan {
	results := map[string]*resources.AWSAutoScalingPlansScalingPlan{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSAutoScalingPlansScalingPlan:
			results[name] = resource
		}
	}
	return results
}
1085127
func (qe *QueryEngine) GetPlan(ctx context.Context, logStats *tabletenv.LogStats, sql string, skipQueryPlanCache bool) (*TabletPlan, error) {
	span, ctx := trace.NewSpan(ctx, "QueryEngine.GetPlan")
	defer span.Finish()

	if plan := qe.getQuery(sql); plan != nil {
		return plan, nil
	}

	// Obtain read lock to prevent schema from changing while
	// we build a plan. The read lock allows multiple identical
	// queries to build the same plan. One of them will win by
	// updating the query cache and prevent future races. Due to
	// this, query stats reporting may not be accurate, but it's
	// acceptable because those numbers are best effort.
	qe.mu.RLock()
	defer qe.mu.RUnlock()
	statement, err := sqlparser.Parse(sql)
	if err != nil {
		return nil, err
	}
	splan, err := planbuilder.Build(statement, qe.tables)
	if err != nil {
		return nil, err
	}
	plan := &TabletPlan{Plan: splan}
	plan.Rules = qe.queryRuleSources.FilterByPlan(sql, plan.PlanID, plan.TableName().String())
	plan.buildAuthorized()
	if plan.PlanID.IsSelect() {
		if plan.FieldQuery != nil {
			conn, err := qe.getQueryConn(ctx)
			if err != nil {
				return nil, err
			}
			defer conn.Recycle()

			sql := plan.FieldQuery.Query
			start := time.Now()
			r, err := conn.Exec(ctx, sql, 1, true)
			logStats.AddRewrittenSQL(sql, start)
			if err != nil {
				return nil, err
			}
			plan.Fields = r.Fields
		}
	} else if plan.PlanID == planbuilder.PlanDDL || plan.PlanID == planbuilder.PlanSet {
		return plan, nil
	}
	if !skipQueryPlanCache && !sqlparser.SkipQueryPlanCacheDirective(statement) {
		qe.plans.Set(sql, plan)
	}
	return plan, nil
}
639519
func (s *Queue) SetPricingPlan(v string) *Queue {
	s.PricingPlan = &v
	return s
}
353673
func (a *Account) FrequencyPlans() (map[string]FrequencyPlan, error) {
	var plans map[string]FrequencyPlan
	err := a.get(auth.Public, "/api/v2/frequency-plans", &plans)
	if err != nil {
		return nil, err
	}

	return plans, nil
}
529385
func (m *MarketplacePlan) GetName() string {
	if m == nil || m.Name == nil {
		return ""
	}
	return *m.Name
}
93789
func (c *Client) ListBillingPlans(bplp BillingPlanListParams) (*BillingPlanListResp, error) {
	req, err := c.NewRequest("GET", fmt.Sprintf("%s%s", c.APIBase, "/v2/payments/billing-plans"), nil)
	q := req.URL.Query()
	q.Add("page", bplp.Page)
	q.Add("page_size", bplp.PageSize)
	q.Add("status", bplp.Status)
	q.Add("total_required", bplp.TotalRequired)
	req.URL.RawQuery = q.Encode()
	response := &BillingPlanListResp{}
	if err != nil {
		return response, err
	}
	err = c.SendWithAuth(req, response)
	return response, err
}
114653
func (gce *Cloud) GetURLMap(name string) (*compute.UrlMap, error) {
	return gce.service.UrlMaps.Get(gce.projectID, name).Do()
}