arazzo: 1.0.1
info:
title: New Relic Prune NRQL Condition
summary: Resolve a policy by name, list its NRQL conditions, and delete one.
description: >-
A cleanup pattern for retiring stale NRQL alert conditions. The workflow
resolves an alert policy by name, lists the NRQL conditions attached to that
policy, captures one condition id, and deletes it so the policy no longer
evaluates the retired query. Every step spells out its request inline so the
flow can be read and executed without opening the underlying OpenAPI
description.
version: 1.0.0
sourceDescriptions:
- name: alertsApi
url: ../openapi/new-relic-alerts-api-openapi.yml
type: openapi
workflows:
- workflowId: prune-nrql-condition
summary: Resolve a policy, find a NRQL condition, and delete it.
description: >-
Filters policies by name, lists the NRQL conditions scoped to the matched
policy, captures the first condition id, and deletes it.
inputs:
type: object
required:
- policyName
properties:
policyName:
type: string
description: The exact name of the alert policy whose NRQL condition to prune.
steps:
- stepId: findPolicy
description: Resolve the alert policy id by exact name.
operationId: getAlertsPolicies
parameters:
- name: filter[name]
in: query
value: $inputs.policyName
successCriteria:
- condition: $statusCode == 200
outputs:
policyId: $response.body#/policy/id
- stepId: listNrqlConditions
description: >-
List the NRQL conditions attached to the resolved policy and capture a
condition id to delete.
operationId: getAlertsNrqlConditions
parameters:
- name: policy_id
in: query
value: $steps.findPolicy.outputs.policyId
successCriteria:
- condition: $statusCode == 200
outputs:
conditionId: $response.body#/nrql_condition/id
- stepId: deleteNrqlCondition
description: >-
Delete the identified NRQL condition so the policy stops evaluating the
retired query.
operationId: deleteAlertsNrqlConditionsConditionId
parameters:
- name: condition_id
in: path
value: $steps.listNrqlConditions.outputs.conditionId
successCriteria:
- condition: $statusCode == 200
outputs:
deletedCondition: $response.body#/nrql_condition
outputs:
policyId: $steps.findPolicy.outputs.policyId
deletedConditionId: $steps.listNrqlConditions.outputs.conditionId
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.