ca/cac/codegen_client.go
func (loc *AnalysisSnapshotLocator) Create(endTime *time.Time, granularity string, startTime *time.Time, options rsapi.APIParams) (*AnalysisSnapshotLocator, error) {
	var res *AnalysisSnapshotLocator
	if granularity == "" {
		return res, fmt.Errorf("granularity 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{
		"end_time":    endTime,
		"granularity": granularity,
		"start_time":  startTime,
	}
	var excludedTagTypesOpt = options["excluded_tag_types"]
	if excludedTagTypesOpt != nil {
		p["excluded_tag_types"] = excludedTagTypesOpt
	}
	var filtersOpt = options["filters"]
	if filtersOpt != nil {
		p["filters"] = filtersOpt
	}
	var isComparisonOpt = options["is_comparison"]
	if isComparisonOpt != nil {
		p["is_comparison"] = isComparisonOpt
	}
	var metricsOpt = options["metrics"]
	if metricsOpt != nil {
		p["metrics"] = metricsOpt
	}
	var moduleStatesOpt = options["module_states"]
	if moduleStatesOpt != nil {
		p["module_states"] = moduleStatesOpt
	}
	uri, err := loc.ActionPath("AnalysisSnapshot", "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 &AnalysisSnapshotLocator{Href(location), loc.api}, nil
	}
}
func (loc *AnalysisSnapshotLocator) Create(endTime *time.Time, granularity string, startTime *time.Time, options rsapi.APIParams) (*AnalysisSnapshotLocator, error) {
	var res *AnalysisSnapshotLocator
	if granularity == "" {
		return res, fmt.Errorf("granularity 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{
		"end_time":    endTime,
		"granularity": granularity,
		"start_time":  startTime,
	}
	var excludedTagTypesOpt = options["excluded_tag_types"]
	if excludedTagTypesOpt != nil {
		p["excluded_tag_types"] = excludedTagTypesOpt
	}
	var filtersOpt = options["filters"]
	if filtersOpt != nil {
		p["filters"] = filtersOpt
	}
	var isComparisonOpt = options["is_comparison"]
	if isComparisonOpt != nil {
		p["is_comparison"] = isComparisonOpt
	}
	var metricsOpt = options["metrics"]
	if metricsOpt != nil {
		p["metrics"] = metricsOpt
	}
	var moduleStatesOpt = options["module_states"]
	if moduleStatesOpt != nil {
		p["module_states"] = moduleStatesOpt
	}
	uri, err := loc.ActionPath("AnalysisSnapshot", "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 &AnalysisSnapshotLocator{Href(location), loc.api}, nil
	}
}
//===== Actions
// POST /api/analysis_snapshots
//
// Create a new AnalysisSnapshot.