func (client *AutoRestReportServiceClient) getReportHandleError(resp *http.Response) error {
	body, err := runtime.Payload(resp)
	if err != nil {
		return runtime.NewResponseError(err, resp)
	}
	errType := Error{raw: string(body)}
	if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
		return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
	}
	return runtime.NewResponseError(&errType, resp)
}
getReportHandleError handles the GetReport error response.
package reportgroup
import (
	"context"
	"fmt"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
	"net/http"
)
type AutoRestReportServiceClient struct {
	con *Connection
}
func NewAutoRestReportServiceClient(con *Connection) *AutoRestReportServiceClient {
	return &AutoRestReportServiceClient{con: con}
}
func (client *AutoRestReportServiceClient) GetOptionalReport(ctx context.Context, options *AutoRestReportServiceGetOptionalReportOptions) (AutoRestReportServiceGetOptionalReportResponse, error) {
	req, err := client.getOptionalReportCreateRequest(ctx, options)
	if err != nil {
		return AutoRestReportServiceGetOptionalReportResponse{}, err
	}
	resp, err := client.con.Pipeline().Do(req)
	if err != nil {
		return AutoRestReportServiceGetOptionalReportResponse{}, err
	}
	if !runtime.HasStatusCode(resp, http.StatusOK) {
		return AutoRestReportServiceGetOptionalReportResponse{}, client.getOptionalReportHandleError(resp)
	}
	return client.getOptionalReportHandleResponse(resp)
}
func (client *AutoRestReportServiceClient) getOptionalReportCreateRequest(ctx context.Context, options *AutoRestReportServiceGetOptionalReportOptions) (*policy.Request, error) {
	urlPath := "/report/optional"
	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.con.Endpoint(), urlPath))
	if err != nil {
		return nil, err
	}
	reqQP := req.Raw().URL.Query()
	if options != nil && options.Qualifier != nil {
		reqQP.Set("qualifier", *options.Qualifier)
	}
	req.Raw().URL.RawQuery = reqQP.Encode()
	req.Raw().Header.Set("Accept", "application/json")
	return req, nil
}
func (client *AutoRestReportServiceClient) getOptionalReportHandleResponse(resp *http.Response) (AutoRestReportServiceGetOptionalReportResponse, error) {
	result := AutoRestReportServiceGetOptionalReportResponse{RawResponse: resp}
	if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil {
		return AutoRestReportServiceGetOptionalReportResponse{}, runtime.NewResponseError(err, resp)
	}
	return result, nil
}
func (client *AutoRestReportServiceClient) getOptionalReportHandleError(resp *http.Response) error {
	body, err := runtime.Payload(resp)
	if err != nil {
		return runtime.NewResponseError(err, resp)
	}
	errType := Error{raw: string(body)}
	if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil {
		return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp)
	}
	return runtime.NewResponseError(&errType, resp)
}
func (client *AutoRestReportServiceClient) GetReport(ctx context.Context, options *AutoRestReportServiceGetReportOptions) (AutoRestReportServiceGetReportResponse, error) {
	req, err := client.getReportCreateRequest(ctx, options)
	if err != nil {
		return AutoRestReportServiceGetReportResponse{}, err
	}
	resp, err := client.con.Pipeline().Do(req)
	if err != nil {
		return AutoRestReportServiceGetReportResponse{}, err
	}
	if !runtime.HasStatusCode(resp, http.StatusOK) {
		return AutoRestReportServiceGetReportResponse{}, client.getReportHandleError(resp)
	}
	return client.getReportHandleResponse(resp)
}
func (client *AutoRestReportServiceClient) getReportCreateRequest(ctx context.Context, options *AutoRestReportServiceGetReportOptions) (*policy.Request, error) {
	urlPath := "/report"
	req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.con.Endpoint(), urlPath))
	if err != nil {
		return nil, err
	}
	reqQP := req.Raw().URL.Query()
	if options != nil && options.Qualifier != nil {
		reqQP.Set("qualifier", *options.Qualifier)
	}
	req.Raw().URL.RawQuery = reqQP.Encode()
	req.Raw().Header.Set("Accept", "application/json")
	return req, nil
}
func (client *AutoRestReportServiceClient) getReportHandleResponse(resp *http.Response) (AutoRestReportServiceGetReportResponse, error) {
	result := AutoRestReportServiceGetReportResponse{RawResponse: resp}
	if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil {
		return AutoRestReportServiceGetReportResponse{}, runtime.NewResponseError(err, resp)
	}
	return result, nil
}