ViewByScope

class ViewByScope : KotlinCustomResource

States and configurations of Cost Analysis. Uses Azure REST API version 2023-03-01. In version 1.x of the Azure Native provider, it used API version 2019-11-01. Other available API versions: 2019-11-01, 2020-06-01, 2022-10-01, 2022-10-05-preview, 2023-04-01-preview, 2023-07-01-preview, 2023-08-01, 2023-09-01, 2023-11-01, 2024-08-01, 2024-10-01-preview.

Example Usage

ResourceGroupCreateOrUpdateView

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var viewByScope = new AzureNative.CostManagement.ViewByScope("viewByScope", new()
{
Accumulated = AzureNative.CostManagement.AccumulatedType.@True,
Chart = AzureNative.CostManagement.ChartType.Table,
DataSet = new AzureNative.CostManagement.Inputs.ReportConfigDatasetArgs
{
Aggregation =
{
{ "totalCost", new AzureNative.CostManagement.Inputs.ReportConfigAggregationArgs
{
Function = AzureNative.CostManagement.FunctionType.Sum,
Name = "PreTaxCost",
} },
},
Granularity = AzureNative.CostManagement.ReportGranularityType.Daily,
Grouping = new() { },
Sorting = new[]
{
new AzureNative.CostManagement.Inputs.ReportConfigSortingArgs
{
Direction = AzureNative.CostManagement.ReportConfigSortingType.Ascending,
Name = "UsageDate",
},
},
},
DisplayName = "swagger Example",
ETag = "\"1d4ff9fe66f1d10\"",
Kpis = new[]
{
new AzureNative.CostManagement.Inputs.KpiPropertiesArgs
{
Enabled = true,
Type = AzureNative.CostManagement.KpiTypeType.Forecast,
},
new AzureNative.CostManagement.Inputs.KpiPropertiesArgs
{
Enabled = true,
Id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo",
Type = AzureNative.CostManagement.KpiTypeType.Budget,
},
},
Metric = AzureNative.CostManagement.MetricType.ActualCost,
Pivots = new[]
{
new AzureNative.CostManagement.Inputs.PivotPropertiesArgs
{
Name = "ServiceName",
Type = AzureNative.CostManagement.PivotTypeType.Dimension,
},
new AzureNative.CostManagement.Inputs.PivotPropertiesArgs
{
Name = "MeterCategory",
Type = AzureNative.CostManagement.PivotTypeType.Dimension,
},
new AzureNative.CostManagement.Inputs.PivotPropertiesArgs
{
Name = "swaggerTagKey",
Type = AzureNative.CostManagement.PivotTypeType.TagKey,
},
},
Scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG",
Timeframe = AzureNative.CostManagement.ReportTimeframeType.MonthToDate,
Type = AzureNative.CostManagement.ReportType.Usage,
ViewName = "swaggerExample",
});
});
package main
import (
costmanagement "github.com/pulumi/pulumi-azure-native-sdk/costmanagement/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := costmanagement.NewViewByScope(ctx, "viewByScope", &costmanagement.ViewByScopeArgs{
Accumulated: pulumi.String(costmanagement.AccumulatedTypeTrue),
Chart: pulumi.String(costmanagement.ChartTypeTable),
DataSet: &costmanagement.ReportConfigDatasetArgs{
Aggregation: costmanagement.ReportConfigAggregationMap{
"totalCost": &costmanagement.ReportConfigAggregationArgs{
Function: pulumi.String(costmanagement.FunctionTypeSum),
Name: pulumi.String("PreTaxCost"),
},
},
Granularity: pulumi.String(costmanagement.ReportGranularityTypeDaily),
Grouping: costmanagement.ReportConfigGroupingArray{},
Sorting: costmanagement.ReportConfigSortingArray{
&costmanagement.ReportConfigSortingArgs{
Direction: pulumi.String(costmanagement.ReportConfigSortingTypeAscending),
Name: pulumi.String("UsageDate"),
},
},
},
DisplayName: pulumi.String("swagger Example"),
ETag: pulumi.String("\"1d4ff9fe66f1d10\""),
Kpis: costmanagement.KpiPropertiesArray{
&costmanagement.KpiPropertiesArgs{
Enabled: pulumi.Bool(true),
Type: pulumi.String(costmanagement.KpiTypeTypeForecast),
},
&costmanagement.KpiPropertiesArgs{
Enabled: pulumi.Bool(true),
Id: pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo"),
Type: pulumi.String(costmanagement.KpiTypeTypeBudget),
},
},
Metric: pulumi.String(costmanagement.MetricTypeActualCost),
Pivots: costmanagement.PivotPropertiesArray{
&costmanagement.PivotPropertiesArgs{
Name: pulumi.String("ServiceName"),
Type: pulumi.String(costmanagement.PivotTypeTypeDimension),
},
&costmanagement.PivotPropertiesArgs{
Name: pulumi.String("MeterCategory"),
Type: pulumi.String(costmanagement.PivotTypeTypeDimension),
},
&costmanagement.PivotPropertiesArgs{
Name: pulumi.String("swaggerTagKey"),
Type: pulumi.String(costmanagement.PivotTypeTypeTagKey),
},
},
Scope: pulumi.String("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"),
Timeframe: pulumi.String(costmanagement.ReportTimeframeTypeMonthToDate),
Type: pulumi.String(costmanagement.ReportTypeUsage),
ViewName: pulumi.String("swaggerExample"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.costmanagement.ViewByScope;
import com.pulumi.azurenative.costmanagement.ViewByScopeArgs;
import com.pulumi.azurenative.costmanagement.inputs.ReportConfigDatasetArgs;
import com.pulumi.azurenative.costmanagement.inputs.KpiPropertiesArgs;
import com.pulumi.azurenative.costmanagement.inputs.PivotPropertiesArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var viewByScope = new ViewByScope("viewByScope", ViewByScopeArgs.builder()
.accumulated("true")
.chart("Table")
.dataSet(ReportConfigDatasetArgs.builder()
.aggregation(Map.of("totalCost", Map.ofEntries(
Map.entry("function", "Sum"),
Map.entry("name", "PreTaxCost")
)))
.granularity("Daily")
.grouping()
.sorting(ReportConfigSortingArgs.builder()
.direction("Ascending")
.name("UsageDate")
.build())
.build())
.displayName("swagger Example")
.eTag("\"1d4ff9fe66f1d10\"")
.kpis(
KpiPropertiesArgs.builder()
.enabled(true)
.type("Forecast")
.build(),
KpiPropertiesArgs.builder()
.enabled(true)
.id("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo")
.type("Budget")
.build())
.metric("ActualCost")
.pivots(
PivotPropertiesArgs.builder()
.name("ServiceName")
.type("Dimension")
.build(),
PivotPropertiesArgs.builder()
.name("MeterCategory")
.type("Dimension")
.build(),
PivotPropertiesArgs.builder()
.name("swaggerTagKey")
.type("TagKey")
.build())
.scope("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG")
.timeframe("MonthToDate")
.type("Usage")
.viewName("swaggerExample")
.build());
}
}

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:costmanagement:ViewByScope swaggerExample /{scope}/providers/Microsoft.CostManagement/views/{viewName}

Properties

Link copied to clipboard
val accumulated: Output<String>?

Show costs accumulated over time.

Link copied to clipboard
val chart: Output<String>?

Chart type of the main view in Cost Analysis. Required.

Link copied to clipboard
val createdOn: Output<String>

Date the user created this view.

Link copied to clipboard
val currency: Output<String>

Currency of the current view.

Link copied to clipboard

Has definition for data in this report config.

Link copied to clipboard
val dateRange: Output<String>?

Date range of the current view.

Link copied to clipboard
val displayName: Output<String>?

User input name of the view. Required.

Link copied to clipboard
val eTag: Output<String>?

eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

If true, report includes monetary commitment.

Link copied to clipboard

List of KPIs to show in Cost Analysis UI.

Link copied to clipboard
val metric: Output<String>?

Metric to use when displaying costs.

Link copied to clipboard
val modifiedOn: Output<String>?

Date when the user last modified this view.

Link copied to clipboard
val name: Output<String>

Resource name.

Link copied to clipboard

Configuration of 3 sub-views in the Cost Analysis UI.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val scope: Output<String>?

Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope.

Link copied to clipboard
val timeframe: Output<String>

The time frame for pulling data for the report. If custom, then a specific time period must be provided.

Link copied to clipboard

Has time period for pulling data for the report.

Link copied to clipboard
val type: Output<String>

Resource type.

Link copied to clipboard
val urn: Output<String>