pub struct CostReportHandler { /* private fields */ }Expand description
Handler for cost report operations
Provides methods to generate and download cost reports in FOCUS format.
Implementations§
Source§impl CostReportHandler
impl CostReportHandler
Sourcepub fn new(client: CloudClient) -> Self
pub fn new(client: CloudClient) -> Self
Create a new handler
Sourcepub async fn generate_cost_report(
&self,
request: CostReportCreateRequest,
) -> Result<TaskStateUpdate>
pub async fn generate_cost_report( &self, request: CostReportCreateRequest, ) -> Result<TaskStateUpdate>
Generate a cost report (Beta)
Generates a cost report in FOCUS format for the specified time period and filters. The maximum date range is 40 days.
This is an asynchronous operation. The returned TaskStateUpdate contains a task_id that can be used to track progress. Once complete, the task response will contain the costReportId needed to download the report.
POST /cost-report
§Arguments
request- The cost report generation request with date range and filters
§Returns
A TaskStateUpdate with the task ID for tracking the generation
§Example
let handler = CostReportHandler::new(client);
let request = CostReportCreateRequest::new("2025-01-01", "2025-01-31");
let task = handler.generate_cost_report(request).await?;
println!("Task ID: {:?}", task.task_id);Sourcepub async fn generate_cost_report_raw(
&self,
request: CostReportCreateRequest,
) -> Result<Value>
pub async fn generate_cost_report_raw( &self, request: CostReportCreateRequest, ) -> Result<Value>
Generate a cost report and return raw JSON response
POST /cost-report
Sourcepub async fn download_cost_report(
&self,
cost_report_id: &str,
) -> Result<Vec<u8>>
pub async fn download_cost_report( &self, cost_report_id: &str, ) -> Result<Vec<u8>>
Download a generated cost report (Beta)
Returns the generated cost report file in FOCUS format. The costReportId is obtained from the task response after the generation task completes.
GET /cost-report/{costReportId}
§Arguments
cost_report_id- The cost report ID from the completed generation task
§Returns
The raw bytes of the cost report file (CSV or JSON depending on request)
§Example
let handler = CostReportHandler::new(client);
let report = handler.download_cost_report("cost-report-12345").await?;
std::fs::write("cost-report.csv", report)?;