ca/cac/codegen_client.go
func (loc *ReservedInstancePurchaseLocator) Create(autoRenew bool, duration int, offeringType string, quantity int, startDate *time.Time, options rsapi.APIParams) (*ReservedInstancePurchaseLocator, error) {
	var res *ReservedInstancePurchaseLocator
	if offeringType == "" {
		return res, fmt.Errorf("offeringType is required")
	}
	var params rsapi.APIParams
	params = rsapi.APIParams{}
	var viewOpt = options["view"]
	if viewOpt != nil {
		params["view"] = viewOpt
	}
	var p rsapi.APIParams
	p = rsapi.APIParams{
		"auto_renew":    autoRenew,
		"duration":      duration,
		"offering_type": offeringType,
		"quantity":      quantity,
		"start_date":    startDate,
	}
	uri, err := loc.ActionPath("ReservedInstancePurchase", "create")
	if err != nil {
		return res, err
	}
	req, err := loc.api.BuildHTTPRequest(uri.HTTPMethod, uri.Path, APIVersion, params, p)
	if err != nil {
		return res, err
	}
	resp, err := loc.api.PerformRequest(req)
	if err != nil {
		return res, err
	}
	defer resp.Body.Close()
	if resp.StatusCode < 200 || resp.StatusCode > 299 {
		respBody, _ := ioutil.ReadAll(resp.Body)
		sr := string(respBody)
		if sr != "" {
			sr = ": " + sr
		}
		return res, fmt.Errorf("invalid response %s%s", resp.Status, sr)
	}
	location := resp.Header.Get("Location")
	if len(location) == 0 {
		return res, fmt.Errorf("Missing location header in response")
	} else {
		return &ReservedInstancePurchaseLocator{Href(location), loc.api}, nil
	}
}
func (loc *ReservedInstancePurchaseLocator) Create(autoRenew bool, duration int, offeringType string, quantity int, startDate *time.Time, options rsapi.APIParams) (*ReservedInstancePurchaseLocator, error) {
	var res *ReservedInstancePurchaseLocator
	if offeringType == "" {
		return res, fmt.Errorf("offeringType is required")
	}
	var params rsapi.APIParams
	params = rsapi.APIParams{}
	var viewOpt = options["view"]
	if viewOpt != nil {
		params["view"] = viewOpt
	}
	var p rsapi.APIParams
	p = rsapi.APIParams{
		"auto_renew":    autoRenew,
		"duration":      duration,
		"offering_type": offeringType,
		"quantity":      quantity,
		"start_date":    startDate,
	}
	uri, err := loc.ActionPath("ReservedInstancePurchase", "create")
	if err != nil {
		return res, err
	}
	req, err := loc.api.BuildHTTPRequest(uri.HTTPMethod, uri.Path, APIVersion, params, p)
	if err != nil {
		return res, err
	}
	resp, err := loc.api.PerformRequest(req)
	if err != nil {
		return res, err
	}
	defer resp.Body.Close()
	if resp.StatusCode < 200 || resp.StatusCode > 299 {
		respBody, _ := ioutil.ReadAll(resp.Body)
		sr := string(respBody)
		if sr != "" {
			sr = ": " + sr
		}
		return res, fmt.Errorf("invalid response %s%s", resp.Status, sr)
	}
	location := resp.Header.Get("Location")
	if len(location) == 0 {
		return res, fmt.Errorf("Missing location header in response")
	} else {
		return &ReservedInstancePurchaseLocator{Href(location), loc.api}, nil
	}
}
//===== Actions
// POST /api/scenarios/:scenario_id/instance_combinations/:instance_combination_id/reserved_instance_purchases
//
// Create a new ReservedInstancePurchase. This is not actually purchased in the cloud and is only used for cost simulation purposes.