1. Packages
  2. New Relic
  3. API Docs
  4. getAlertPolicy
New Relic v5.22.0 published on Wednesday, Mar 27, 2024 by Pulumi

newrelic.getAlertPolicy

Explore with Pulumi AI

newrelic logo
New Relic v5.22.0 published on Wednesday, Mar 27, 2024 by Pulumi

    Use this data source to get information about a specific alert policy in New Relic that already exists.

    Example Usage

    Coming soon!```
    </pulumi-choosable>
    </div>
    <div>
    <pulumi-choosable type="language" values="python">
    

    Coming soon!```

    Coming soon!```
    </pulumi-choosable>
    </div>
    <div>
    <pulumi-choosable type="language" values="csharp">
    

    Coming soon!```

    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.NewrelicFunctions;
    import com.pulumi.newrelic.inputs.GetAlertChannelArgs;
    import com.pulumi.newrelic.inputs.GetAlertPolicyArgs;
    import com.pulumi.newrelic.AlertPolicyChannel;
    import com.pulumi.newrelic.AlertPolicyChannelArgs;
    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 fooAlertChannel = NewrelicFunctions.getAlertChannel(GetAlertChannelArgs.builder()
                .name("foo@example.com")
                .build());
    
            final var fooAlertPolicy = NewrelicFunctions.getAlertPolicy(GetAlertPolicyArgs.builder()
                .name("foo policy")
                .build());
    
            var fooAlertPolicyChannel = new AlertPolicyChannel("fooAlertPolicyChannel", AlertPolicyChannelArgs.builder()        
                .policyId(fooAlertPolicy.applyValue(getAlertPolicyResult -> getAlertPolicyResult.id()))
                .channelId(fooAlertChannel.applyValue(getAlertChannelResult -> getAlertChannelResult.id()))
                .build());
    
        }
    }
    
    resources:
      fooAlertPolicyChannel:
        type: newrelic:AlertPolicyChannel
        properties:
          policyId: ${fooAlertPolicy.id}
          channelId: ${fooAlertChannel.id}
    variables:
      fooAlertChannel:
        fn::invoke:
          Function: newrelic:getAlertChannel
          Arguments:
            name: foo@example.com
      fooAlertPolicy:
        fn::invoke:
          Function: newrelic:getAlertPolicy
          Arguments:
            name: foo policy
    

    Using getAlertPolicy

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getAlertPolicy(args: GetAlertPolicyArgs, opts?: InvokeOptions): Promise<GetAlertPolicyResult>
    function getAlertPolicyOutput(args: GetAlertPolicyOutputArgs, opts?: InvokeOptions): Output<GetAlertPolicyResult>
    def get_alert_policy(account_id: Optional[int] = None,
                         incident_preference: Optional[str] = None,
                         name: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetAlertPolicyResult
    def get_alert_policy_output(account_id: Optional[pulumi.Input[int]] = None,
                         incident_preference: Optional[pulumi.Input[str]] = None,
                         name: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetAlertPolicyResult]
    func LookupAlertPolicy(ctx *Context, args *LookupAlertPolicyArgs, opts ...InvokeOption) (*LookupAlertPolicyResult, error)
    func LookupAlertPolicyOutput(ctx *Context, args *LookupAlertPolicyOutputArgs, opts ...InvokeOption) LookupAlertPolicyResultOutput

    > Note: This function is named LookupAlertPolicy in the Go SDK.

    public static class GetAlertPolicy 
    {
        public static Task<GetAlertPolicyResult> InvokeAsync(GetAlertPolicyArgs args, InvokeOptions? opts = null)
        public static Output<GetAlertPolicyResult> Invoke(GetAlertPolicyInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAlertPolicyResult> getAlertPolicy(GetAlertPolicyArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: newrelic:index/getAlertPolicy:getAlertPolicy
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    The name of the alert policy in New Relic.
    AccountId int
    The New Relic account ID to operate on. This allows you to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.
    IncidentPreference string
    The rollup strategy for the policy, which can have one of the following values:
    Name string
    The name of the alert policy in New Relic.
    AccountId int
    The New Relic account ID to operate on. This allows you to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.
    IncidentPreference string
    The rollup strategy for the policy, which can have one of the following values:
    name String
    The name of the alert policy in New Relic.
    accountId Integer
    The New Relic account ID to operate on. This allows you to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.
    incidentPreference String
    The rollup strategy for the policy, which can have one of the following values:
    name string
    The name of the alert policy in New Relic.
    accountId number
    The New Relic account ID to operate on. This allows you to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.
    incidentPreference string
    The rollup strategy for the policy, which can have one of the following values:
    name str
    The name of the alert policy in New Relic.
    account_id int
    The New Relic account ID to operate on. This allows you to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.
    incident_preference str
    The rollup strategy for the policy, which can have one of the following values:
    name String
    The name of the alert policy in New Relic.
    accountId Number
    The New Relic account ID to operate on. This allows you to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.
    incidentPreference String
    The rollup strategy for the policy, which can have one of the following values:

    getAlertPolicy Result

    The following output properties are available:

    AccountId int
    CreatedAt string
    The time the policy was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    UpdatedAt string
    The time the policy was last updated.
    IncidentPreference string
    The rollup strategy for the policy, which can have one of the following values:
    AccountId int
    CreatedAt string
    The time the policy was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    UpdatedAt string
    The time the policy was last updated.
    IncidentPreference string
    The rollup strategy for the policy, which can have one of the following values:
    accountId Integer
    createdAt String
    The time the policy was created.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    updatedAt String
    The time the policy was last updated.
    incidentPreference String
    The rollup strategy for the policy, which can have one of the following values:
    accountId number
    createdAt string
    The time the policy was created.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    updatedAt string
    The time the policy was last updated.
    incidentPreference string
    The rollup strategy for the policy, which can have one of the following values:
    account_id int
    created_at str
    The time the policy was created.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    updated_at str
    The time the policy was last updated.
    incident_preference str
    The rollup strategy for the policy, which can have one of the following values:
    accountId Number
    createdAt String
    The time the policy was created.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    updatedAt String
    The time the policy was last updated.
    incidentPreference String
    The rollup strategy for the policy, which can have one of the following values:

    Package Details

    Repository
    New Relic pulumi/pulumi-newrelic
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the newrelic Terraform Provider.
    newrelic logo
    New Relic v5.22.0 published on Wednesday, Mar 27, 2024 by Pulumi