wavefront logo
Wavefront v1.4.0, May 19 23

wavefront.MetricsPolicy

Explore with Pulumi AI

Provides a Wavefront Metrics Policy Resource. This allows management of Metrics Policy to control access to time series, histograms, and delta counters

Data Source

Provides a Wavefront Metrics Policy Data Source. This allows looking up the current policy and associated rules.

Example

import * as pulumi from "@pulumi/pulumi";
import * as wavefront from "@pulumi/wavefront";

const policyMetricsPolicy = wavefront.getMetricsPolicy({});
export const policy = policyMetricsPolicy;
import pulumi
import pulumi_wavefront as wavefront

policy_metrics_policy = wavefront.get_metrics_policy()
pulumi.export("policy", policy_metrics_policy)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Wavefront = Pulumi.Wavefront;

return await Deployment.RunAsync(() => 
{
    var policyMetricsPolicy = Wavefront.GetMetricsPolicy.Invoke();

    return new Dictionary<string, object?>
    {
        ["policy"] = policyMetricsPolicy,
    };
});
package main

import (
	"github.com/pulumi/pulumi-wavefront/sdk/go/wavefront"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		policyMetricsPolicy, err := wavefront.LookupMetricsPolicy(ctx, nil, nil)
		if err != nil {
			return err
		}
		ctx.Export("policy", policyMetricsPolicy)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.wavefront.WavefrontFunctions;
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) {
        final var policyMetricsPolicy = WavefrontFunctions.getMetricsPolicy();

        ctx.export("policy", policyMetricsPolicy.applyValue(getMetricsPolicyResult -> getMetricsPolicyResult));
    }
}
variables:
  policyMetricsPolicy:
    fn::invoke:
      Function: wavefront:getMetricsPolicy
      Arguments: {}
outputs:
  policy: ${policyMetricsPolicy}

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Wavefront = Pulumi.Wavefront;

return await Deployment.RunAsync(() => 
{
    var everyone = Wavefront.GetDefaultUserGroup.Invoke();

    var main = new Wavefront.MetricsPolicy("main", new()
    {
        PolicyRules = new[]
        {
            new Wavefront.Inputs.MetricsPolicyPolicyRuleArgs
            {
                Name = "Allow All Metrics",
                Description = "Predefined policy rule. Allows access to all metrics (timeseries, histograms, and counters) for all accounts. If this rule is removed, all accounts can access all metrics if there are no matching blocking rules.",
                Prefixes = new[]
                {
                    "*",
                },
                TagsAnded = false,
                AccessType = "ALLOW",
                UserGroupIds = new[]
                {
                    everyone.Apply(getDefaultUserGroupResult => getDefaultUserGroupResult.GroupId),
                },
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-wavefront/sdk/go/wavefront"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		everyone, err := wavefront.GetDefaultUserGroup(ctx, nil, nil)
		if err != nil {
			return err
		}
		_, err = wavefront.NewMetricsPolicy(ctx, "main", &wavefront.MetricsPolicyArgs{
			PolicyRules: wavefront.MetricsPolicyPolicyRuleArray{
				&wavefront.MetricsPolicyPolicyRuleArgs{
					Name:        pulumi.String("Allow All Metrics"),
					Description: pulumi.String("Predefined policy rule. Allows access to all metrics (timeseries, histograms, and counters) for all accounts. If this rule is removed, all accounts can access all metrics if there are no matching blocking rules."),
					Prefixes: pulumi.StringArray{
						pulumi.String("*"),
					},
					TagsAnded:  pulumi.Bool(false),
					AccessType: pulumi.String("ALLOW"),
					UserGroupIds: pulumi.StringArray{
						*pulumi.String(everyone.GroupId),
					},
				},
			},
		})
		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.wavefront.WavefrontFunctions;
import com.pulumi.wavefront.MetricsPolicy;
import com.pulumi.wavefront.MetricsPolicyArgs;
import com.pulumi.wavefront.inputs.MetricsPolicyPolicyRuleArgs;
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) {
        final var everyone = WavefrontFunctions.getDefaultUserGroup();

        var main = new MetricsPolicy("main", MetricsPolicyArgs.builder()        
            .policyRules(MetricsPolicyPolicyRuleArgs.builder()
                .name("Allow All Metrics")
                .description("Predefined policy rule. Allows access to all metrics (timeseries, histograms, and counters) for all accounts. If this rule is removed, all accounts can access all metrics if there are no matching blocking rules.")
                .prefixes("*")
                .tagsAnded(false)
                .accessType("ALLOW")
                .userGroupIds(everyone.applyValue(getDefaultUserGroupResult -> getDefaultUserGroupResult.groupId()))
                .build())
            .build());

    }
}
import pulumi
import pulumi_wavefront as wavefront

everyone = wavefront.get_default_user_group()
main = wavefront.MetricsPolicy("main", policy_rules=[wavefront.MetricsPolicyPolicyRuleArgs(
    name="Allow All Metrics",
    description="Predefined policy rule. Allows access to all metrics (timeseries, histograms, and counters) for all accounts. If this rule is removed, all accounts can access all metrics if there are no matching blocking rules.",
    prefixes=["*"],
    tags_anded=False,
    access_type="ALLOW",
    user_group_ids=[everyone.group_id],
)])
import * as pulumi from "@pulumi/pulumi";
import * as wavefront from "@pulumi/wavefront";

const everyone = wavefront.getDefaultUserGroup({});
const main = new wavefront.MetricsPolicy("main", {policyRules: [{
    name: "Allow All Metrics",
    description: "Predefined policy rule. Allows access to all metrics (timeseries, histograms, and counters) for all accounts. If this rule is removed, all accounts can access all metrics if there are no matching blocking rules.",
    prefixes: ["*"],
    tagsAnded: false,
    accessType: "ALLOW",
    userGroupIds: [everyone.then(everyone => everyone.groupId)],
}]});
resources:
  main:
    type: wavefront:MetricsPolicy
    properties:
      policyRules:
        - name: Allow All Metrics
          description: Predefined policy rule. Allows access to all metrics (timeseries, histograms, and counters) for all accounts. If this rule is removed, all accounts can access all metrics if there are no matching blocking rules.
          prefixes:
            - '*'
          tagsAnded: false
          accessType: ALLOW
          userGroupIds:
            - ${everyone.groupId}
variables:
  everyone:
    fn::invoke:
      Function: wavefront:getDefaultUserGroup
      Arguments: {}

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Wavefront = Pulumi.Wavefront;

return await Deployment.RunAsync(() => 
{
    var policyMetricsPolicy = Wavefront.GetMetricsPolicy.Invoke();

    return new Dictionary<string, object?>
    {
        ["policy"] = policyMetricsPolicy,
    };
});
package main

import (
	"github.com/pulumi/pulumi-wavefront/sdk/go/wavefront"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		policyMetricsPolicy, err := wavefront.LookupMetricsPolicy(ctx, nil, nil)
		if err != nil {
			return err
		}
		ctx.Export("policy", policyMetricsPolicy)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.wavefront.WavefrontFunctions;
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) {
        final var policyMetricsPolicy = WavefrontFunctions.getMetricsPolicy();

        ctx.export("policy", policyMetricsPolicy.applyValue(getMetricsPolicyResult -> getMetricsPolicyResult));
    }
}
import pulumi
import pulumi_wavefront as wavefront

policy_metrics_policy = wavefront.get_metrics_policy()
pulumi.export("policy", policy_metrics_policy)
import * as pulumi from "@pulumi/pulumi";
import * as wavefront from "@pulumi/wavefront";

const policyMetricsPolicy = wavefront.getMetricsPolicy({});
export const policy = policyMetricsPolicy;
variables:
  policyMetricsPolicy:
    fn::invoke:
      Function: wavefront:getMetricsPolicy
      Arguments: {}
outputs:
  policy: ${policyMetricsPolicy}

Create MetricsPolicy Resource

new MetricsPolicy(name: string, args: MetricsPolicyArgs, opts?: CustomResourceOptions);
@overload
def MetricsPolicy(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  policy_rules: Optional[Sequence[MetricsPolicyPolicyRuleArgs]] = None)
@overload
def MetricsPolicy(resource_name: str,
                  args: MetricsPolicyArgs,
                  opts: Optional[ResourceOptions] = None)
func NewMetricsPolicy(ctx *Context, name string, args MetricsPolicyArgs, opts ...ResourceOption) (*MetricsPolicy, error)
public MetricsPolicy(string name, MetricsPolicyArgs args, CustomResourceOptions? opts = null)
public MetricsPolicy(String name, MetricsPolicyArgs args)
public MetricsPolicy(String name, MetricsPolicyArgs args, CustomResourceOptions options)
type: wavefront:MetricsPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args MetricsPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args MetricsPolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args MetricsPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args MetricsPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args MetricsPolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

MetricsPolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The MetricsPolicy resource accepts the following input properties:

PolicyRules List<MetricsPolicyPolicyRuleArgs>

List of Metrics Policies, must have at least one entry.

PolicyRules []MetricsPolicyPolicyRuleArgs

List of Metrics Policies, must have at least one entry.

policyRules List<MetricsPolicyPolicyRuleArgs>

List of Metrics Policies, must have at least one entry.

policyRules MetricsPolicyPolicyRuleArgs[]

List of Metrics Policies, must have at least one entry.

policy_rules Sequence[MetricsPolicyPolicyRuleArgs]

List of Metrics Policies, must have at least one entry.

policyRules List<Property Map>

List of Metrics Policies, must have at least one entry.

Outputs

All input properties are implicitly available as output properties. Additionally, the MetricsPolicy resource produces the following output properties:

Customer string

The customer the user is associated with.

Id string

The provider-assigned unique ID for this managed resource.

UpdatedEpochMillis int

When the policy was applied in epoch_millis.

UpdaterId string

The account_id who applied the current policy.

Customer string

The customer the user is associated with.

Id string

The provider-assigned unique ID for this managed resource.

UpdatedEpochMillis int

When the policy was applied in epoch_millis.

UpdaterId string

The account_id who applied the current policy.

customer String

The customer the user is associated with.

id String

The provider-assigned unique ID for this managed resource.

updatedEpochMillis Integer

When the policy was applied in epoch_millis.

updaterId String

The account_id who applied the current policy.

customer string

The customer the user is associated with.

id string

The provider-assigned unique ID for this managed resource.

updatedEpochMillis number

When the policy was applied in epoch_millis.

updaterId string

The account_id who applied the current policy.

customer str

The customer the user is associated with.

id str

The provider-assigned unique ID for this managed resource.

updated_epoch_millis int

When the policy was applied in epoch_millis.

updater_id str

The account_id who applied the current policy.

customer String

The customer the user is associated with.

id String

The provider-assigned unique ID for this managed resource.

updatedEpochMillis Number

When the policy was applied in epoch_millis.

updaterId String

The account_id who applied the current policy.

Look up Existing MetricsPolicy Resource

Get an existing MetricsPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: MetricsPolicyState, opts?: CustomResourceOptions): MetricsPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        customer: Optional[str] = None,
        policy_rules: Optional[Sequence[MetricsPolicyPolicyRuleArgs]] = None,
        updated_epoch_millis: Optional[int] = None,
        updater_id: Optional[str] = None) -> MetricsPolicy
func GetMetricsPolicy(ctx *Context, name string, id IDInput, state *MetricsPolicyState, opts ...ResourceOption) (*MetricsPolicy, error)
public static MetricsPolicy Get(string name, Input<string> id, MetricsPolicyState? state, CustomResourceOptions? opts = null)
public static MetricsPolicy get(String name, Output<String> id, MetricsPolicyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Customer string

The customer the user is associated with.

PolicyRules List<MetricsPolicyPolicyRuleArgs>

List of Metrics Policies, must have at least one entry.

UpdatedEpochMillis int

When the policy was applied in epoch_millis.

UpdaterId string

The account_id who applied the current policy.

Customer string

The customer the user is associated with.

PolicyRules []MetricsPolicyPolicyRuleArgs

List of Metrics Policies, must have at least one entry.

UpdatedEpochMillis int

When the policy was applied in epoch_millis.

UpdaterId string

The account_id who applied the current policy.

customer String

The customer the user is associated with.

policyRules List<MetricsPolicyPolicyRuleArgs>

List of Metrics Policies, must have at least one entry.

updatedEpochMillis Integer

When the policy was applied in epoch_millis.

updaterId String

The account_id who applied the current policy.

customer string

The customer the user is associated with.

policyRules MetricsPolicyPolicyRuleArgs[]

List of Metrics Policies, must have at least one entry.

updatedEpochMillis number

When the policy was applied in epoch_millis.

updaterId string

The account_id who applied the current policy.

customer str

The customer the user is associated with.

policy_rules Sequence[MetricsPolicyPolicyRuleArgs]

List of Metrics Policies, must have at least one entry.

updated_epoch_millis int

When the policy was applied in epoch_millis.

updater_id str

The account_id who applied the current policy.

customer String

The customer the user is associated with.

policyRules List<Property Map>

List of Metrics Policies, must have at least one entry.

updatedEpochMillis Number

When the policy was applied in epoch_millis.

updaterId String

The account_id who applied the current policy.

Supporting Types

MetricsPolicyPolicyRule

AccessType string

Valid options are ALLOW and BLOCK.

Description string

A detailed description of the Metrics Policy. The description is visible only when you edit the rule.

Name string

The unique name identifier for a Metrics Policy. The name is visible on the Metrics Security Policy page.

Prefixes List<string>

List of prefixes to match metrics on. You can specify the full metric name or use a wildcard character in metric names, sources, or point tags. The wildcard character alone (*) means all metrics.

TagsAnded bool

Bool where true require all tags are met by selected metrics, else false select metrics that match any give tag.

AccountIds List<string>

List of account ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

RoleIds List<string>

List of role ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

Tags List<MetricsPolicyPolicyRuleTag>

List of Key/Value tags to select target metrics for policy.

UserGroupIds List<string>

List of user group ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

AccessType string

Valid options are ALLOW and BLOCK.

Description string

A detailed description of the Metrics Policy. The description is visible only when you edit the rule.

Name string

The unique name identifier for a Metrics Policy. The name is visible on the Metrics Security Policy page.

Prefixes []string

List of prefixes to match metrics on. You can specify the full metric name or use a wildcard character in metric names, sources, or point tags. The wildcard character alone (*) means all metrics.

TagsAnded bool

Bool where true require all tags are met by selected metrics, else false select metrics that match any give tag.

AccountIds []string

List of account ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

RoleIds []string

List of role ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

Tags []MetricsPolicyPolicyRuleTag

List of Key/Value tags to select target metrics for policy.

UserGroupIds []string

List of user group ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

accessType String

Valid options are ALLOW and BLOCK.

description String

A detailed description of the Metrics Policy. The description is visible only when you edit the rule.

name String

The unique name identifier for a Metrics Policy. The name is visible on the Metrics Security Policy page.

prefixes List<String>

List of prefixes to match metrics on. You can specify the full metric name or use a wildcard character in metric names, sources, or point tags. The wildcard character alone (*) means all metrics.

tagsAnded Boolean

Bool where true require all tags are met by selected metrics, else false select metrics that match any give tag.

accountIds List<String>

List of account ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

roleIds List<String>

List of role ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

tags List<MetricsPolicyPolicyRuleTag>

List of Key/Value tags to select target metrics for policy.

userGroupIds List<String>

List of user group ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

accessType string

Valid options are ALLOW and BLOCK.

description string

A detailed description of the Metrics Policy. The description is visible only when you edit the rule.

name string

The unique name identifier for a Metrics Policy. The name is visible on the Metrics Security Policy page.

prefixes string[]

List of prefixes to match metrics on. You can specify the full metric name or use a wildcard character in metric names, sources, or point tags. The wildcard character alone (*) means all metrics.

tagsAnded boolean

Bool where true require all tags are met by selected metrics, else false select metrics that match any give tag.

accountIds string[]

List of account ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

roleIds string[]

List of role ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

tags MetricsPolicyPolicyRuleTag[]

List of Key/Value tags to select target metrics for policy.

userGroupIds string[]

List of user group ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

access_type str

Valid options are ALLOW and BLOCK.

description str

A detailed description of the Metrics Policy. The description is visible only when you edit the rule.

name str

The unique name identifier for a Metrics Policy. The name is visible on the Metrics Security Policy page.

prefixes Sequence[str]

List of prefixes to match metrics on. You can specify the full metric name or use a wildcard character in metric names, sources, or point tags. The wildcard character alone (*) means all metrics.

tags_anded bool

Bool where true require all tags are met by selected metrics, else false select metrics that match any give tag.

account_ids Sequence[str]

List of account ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

role_ids Sequence[str]

List of role ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

tags Sequence[MetricsPolicyPolicyRuleTag]

List of Key/Value tags to select target metrics for policy.

user_group_ids Sequence[str]

List of user group ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

accessType String

Valid options are ALLOW and BLOCK.

description String

A detailed description of the Metrics Policy. The description is visible only when you edit the rule.

name String

The unique name identifier for a Metrics Policy. The name is visible on the Metrics Security Policy page.

prefixes List<String>

List of prefixes to match metrics on. You can specify the full metric name or use a wildcard character in metric names, sources, or point tags. The wildcard character alone (*) means all metrics.

tagsAnded Boolean

Bool where true require all tags are met by selected metrics, else false select metrics that match any give tag.

accountIds List<String>

List of account ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

roleIds List<String>

List of role ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

tags List<Property Map>

List of Key/Value tags to select target metrics for policy.

userGroupIds List<String>

List of user group ids to apply Metrics Policy to. Must have at least one associated account_id, user_group_id, or role_id.

MetricsPolicyPolicyRuleTag

Key string

The tag's key.

Value string

The tag's value.

Key string

The tag's key.

Value string

The tag's value.

key String

The tag's key.

value String

The tag's value.

key string

The tag's key.

value string

The tag's value.

key str

The tag's key.

value str

The tag's value.

key String

The tag's key.

value String

The tag's value.

Import

Users can be imported by using the updated_epoch_millis, e.g.

 $ pulumi import wavefront:index/metricsPolicy:MetricsPolicy some_metrics_policy 1651846476678

Package Details

Repository
Wavefront pulumi/pulumi-wavefront
License
Apache-2.0
Notes

This Pulumi package is based on the wavefront Terraform Provider.