pulumi-newrelic 5.20.0a1709643785__py3-none-any.whl → 5.39.0a1736834464__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. pulumi_newrelic/__init__.py +9 -0
  2. pulumi_newrelic/_inputs.py +7153 -461
  3. pulumi_newrelic/_utilities.py +41 -5
  4. pulumi_newrelic/account_management.py +13 -4
  5. pulumi_newrelic/alert_channel.py +122 -101
  6. pulumi_newrelic/alert_condition.py +120 -109
  7. pulumi_newrelic/alert_muting_rule.py +130 -74
  8. pulumi_newrelic/alert_policy.py +88 -67
  9. pulumi_newrelic/alert_policy_channel.py +81 -68
  10. pulumi_newrelic/api_access_key.py +49 -52
  11. pulumi_newrelic/browser_application.py +79 -76
  12. pulumi_newrelic/cloud/_inputs.py +2527 -1082
  13. pulumi_newrelic/cloud/aws_govcloud_integrations.py +135 -130
  14. pulumi_newrelic/cloud/aws_govcloud_link_account.py +25 -18
  15. pulumi_newrelic/cloud/aws_integrations.py +300 -1324
  16. pulumi_newrelic/cloud/aws_link_account.py +25 -18
  17. pulumi_newrelic/cloud/azure_integrations.py +523 -481
  18. pulumi_newrelic/cloud/azure_link_account.py +36 -29
  19. pulumi_newrelic/cloud/gcp_integrations.py +343 -320
  20. pulumi_newrelic/cloud/gcp_link_account.py +25 -18
  21. pulumi_newrelic/cloud/outputs.py +327 -1072
  22. pulumi_newrelic/config/__init__.pyi +6 -1
  23. pulumi_newrelic/config/vars.py +7 -2
  24. pulumi_newrelic/data_partition_rule.py +23 -16
  25. pulumi_newrelic/entity_tags.py +36 -31
  26. pulumi_newrelic/events_to_metrics_rule.py +27 -20
  27. pulumi_newrelic/get_account.py +24 -12
  28. pulumi_newrelic/get_alert_channel.py +26 -13
  29. pulumi_newrelic/get_alert_policy.py +35 -12
  30. pulumi_newrelic/get_application.py +39 -27
  31. pulumi_newrelic/get_authentication_domain.py +17 -9
  32. pulumi_newrelic/get_cloud_account.py +26 -14
  33. pulumi_newrelic/get_entity.py +90 -85
  34. pulumi_newrelic/get_group.py +58 -9
  35. pulumi_newrelic/get_key_transaction.py +109 -30
  36. pulumi_newrelic/get_notification_destination.py +64 -14
  37. pulumi_newrelic/get_obfuscation_expression.py +36 -24
  38. pulumi_newrelic/get_service_level_alert_helper.py +135 -105
  39. pulumi_newrelic/get_test_grok_pattern.py +29 -14
  40. pulumi_newrelic/get_user.py +17 -5
  41. pulumi_newrelic/group.py +5 -132
  42. pulumi_newrelic/infra_alert_condition.py +157 -140
  43. pulumi_newrelic/insights/_inputs.py +43 -0
  44. pulumi_newrelic/insights/event.py +50 -43
  45. pulumi_newrelic/insights/outputs.py +5 -0
  46. pulumi_newrelic/key_transaction.py +464 -0
  47. pulumi_newrelic/log_parsing_rule.py +29 -18
  48. pulumi_newrelic/monitor_downtime.py +215 -203
  49. pulumi_newrelic/notification_channel.py +387 -326
  50. pulumi_newrelic/notification_destination.py +248 -118
  51. pulumi_newrelic/nrql_alert_condition.py +353 -246
  52. pulumi_newrelic/nrql_drop_rule.py +57 -30
  53. pulumi_newrelic/obfuscation_expression.py +25 -18
  54. pulumi_newrelic/obfuscation_rule.py +40 -31
  55. pulumi_newrelic/one_dashboard.py +31 -26
  56. pulumi_newrelic/one_dashboard_json.py +21 -16
  57. pulumi_newrelic/one_dashboard_raw.py +112 -101
  58. pulumi_newrelic/outputs.py +2446 -245
  59. pulumi_newrelic/plugins/_inputs.py +145 -10
  60. pulumi_newrelic/plugins/application_settings.py +29 -20
  61. pulumi_newrelic/plugins/outputs.py +15 -10
  62. pulumi_newrelic/plugins/workload.py +285 -54
  63. pulumi_newrelic/provider.py +27 -33
  64. pulumi_newrelic/pulumi-plugin.json +2 -1
  65. pulumi_newrelic/service_level.py +193 -180
  66. pulumi_newrelic/synthetics/_inputs.py +159 -2
  67. pulumi_newrelic/synthetics/alert_condition.py +91 -78
  68. pulumi_newrelic/synthetics/broken_links_monitor.py +220 -93
  69. pulumi_newrelic/synthetics/cert_check_monitor.py +223 -94
  70. pulumi_newrelic/synthetics/get_private_location.py +34 -22
  71. pulumi_newrelic/synthetics/get_secure_credential.py +24 -12
  72. pulumi_newrelic/synthetics/monitor.py +352 -179
  73. pulumi_newrelic/synthetics/multi_location_alert_condition.py +109 -96
  74. pulumi_newrelic/synthetics/outputs.py +7 -2
  75. pulumi_newrelic/synthetics/private_location.py +27 -18
  76. pulumi_newrelic/synthetics/script_monitor.py +321 -168
  77. pulumi_newrelic/synthetics/secure_credential.py +25 -20
  78. pulumi_newrelic/synthetics/step_monitor.py +409 -98
  79. pulumi_newrelic/user.py +13 -6
  80. pulumi_newrelic/workflow.py +215 -184
  81. {pulumi_newrelic-5.20.0a1709643785.dist-info → pulumi_newrelic-5.39.0a1736834464.dist-info}/METADATA +7 -6
  82. pulumi_newrelic-5.39.0a1736834464.dist-info/RECORD +90 -0
  83. {pulumi_newrelic-5.20.0a1709643785.dist-info → pulumi_newrelic-5.39.0a1736834464.dist-info}/WHEEL +1 -1
  84. pulumi_newrelic-5.20.0a1709643785.dist-info/RECORD +0 -89
  85. {pulumi_newrelic-5.20.0a1709643785.dist-info → pulumi_newrelic-5.39.0a1736834464.dist-info}/top_level.txt +0 -0
@@ -4,9 +4,14 @@
4
4
 
5
5
  import copy
6
6
  import warnings
7
+ import sys
7
8
  import pulumi
8
9
  import pulumi.runtime
9
10
  from typing import Any, Mapping, Optional, Sequence, Union, overload
11
+ if sys.version_info >= (3, 11):
12
+ from typing import NotRequired, TypedDict, TypeAlias
13
+ else:
14
+ from typing_extensions import NotRequired, TypedDict, TypeAlias
10
15
  from . import _utilities
11
16
 
12
17
  __all__ = ['AlertPolicyArgs', 'AlertPolicy']
@@ -14,14 +19,14 @@ __all__ = ['AlertPolicyArgs', 'AlertPolicy']
14
19
  @pulumi.input_type
15
20
  class AlertPolicyArgs:
16
21
  def __init__(__self__, *,
17
- account_id: Optional[pulumi.Input[int]] = None,
18
- channel_ids: Optional[pulumi.Input[Sequence[pulumi.Input[int]]]] = None,
22
+ account_id: Optional[pulumi.Input[str]] = None,
23
+ channel_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
19
24
  incident_preference: Optional[pulumi.Input[str]] = None,
20
25
  name: Optional[pulumi.Input[str]] = None):
21
26
  """
22
27
  The set of arguments for constructing a AlertPolicy resource.
23
- :param pulumi.Input[int] account_id: The New Relic account ID to operate on. This allows the user to override the `account_id` attribute set on the provider. Defaults to the environment variable `NEW_RELIC_ACCOUNT_ID`.
24
- :param pulumi.Input[Sequence[pulumi.Input[int]]] channel_ids: An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs _cannot_ be imported.
28
+ :param pulumi.Input[str] account_id: The New Relic account ID to operate on. This allows the user to override the `account_id` attribute set on the provider. Defaults to the environment variable `NEW_RELIC_ACCOUNT_ID`.
29
+ :param pulumi.Input[Sequence[pulumi.Input[str]]] channel_ids: An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs _cannot_ be imported.
25
30
  :param pulumi.Input[str] incident_preference: The rollup strategy for the policy. Options include: `PER_POLICY`, `PER_CONDITION`, or `PER_CONDITION_AND_TARGET`. The default is `PER_POLICY`.
26
31
  :param pulumi.Input[str] name: The name of the policy.
27
32
  """
@@ -39,29 +44,27 @@ class AlertPolicyArgs:
39
44
 
40
45
  @property
41
46
  @pulumi.getter(name="accountId")
42
- def account_id(self) -> Optional[pulumi.Input[int]]:
47
+ def account_id(self) -> Optional[pulumi.Input[str]]:
43
48
  """
44
49
  The New Relic account ID to operate on. This allows the user to override the `account_id` attribute set on the provider. Defaults to the environment variable `NEW_RELIC_ACCOUNT_ID`.
45
50
  """
46
51
  return pulumi.get(self, "account_id")
47
52
 
48
53
  @account_id.setter
49
- def account_id(self, value: Optional[pulumi.Input[int]]):
54
+ def account_id(self, value: Optional[pulumi.Input[str]]):
50
55
  pulumi.set(self, "account_id", value)
51
56
 
52
57
  @property
53
58
  @pulumi.getter(name="channelIds")
54
- def channel_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[int]]]]:
59
+ @_utilities.deprecated("""The `channel_ids` attribute is deprecated and will be removed in the next major release of the provider.""")
60
+ def channel_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
55
61
  """
56
62
  An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs _cannot_ be imported.
57
63
  """
58
- warnings.warn("""The `channel_ids` attribute is deprecated and will be removed in the next major release of the provider.""", DeprecationWarning)
59
- pulumi.log.warn("""channel_ids is deprecated: The `channel_ids` attribute is deprecated and will be removed in the next major release of the provider.""")
60
-
61
64
  return pulumi.get(self, "channel_ids")
62
65
 
63
66
  @channel_ids.setter
64
- def channel_ids(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[int]]]]):
67
+ def channel_ids(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
65
68
  pulumi.set(self, "channel_ids", value)
66
69
 
67
70
  @property
@@ -92,14 +95,14 @@ class AlertPolicyArgs:
92
95
  @pulumi.input_type
93
96
  class _AlertPolicyState:
94
97
  def __init__(__self__, *,
95
- account_id: Optional[pulumi.Input[int]] = None,
96
- channel_ids: Optional[pulumi.Input[Sequence[pulumi.Input[int]]]] = None,
98
+ account_id: Optional[pulumi.Input[str]] = None,
99
+ channel_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
97
100
  incident_preference: Optional[pulumi.Input[str]] = None,
98
101
  name: Optional[pulumi.Input[str]] = None):
99
102
  """
100
103
  Input properties used for looking up and filtering AlertPolicy resources.
101
- :param pulumi.Input[int] account_id: The New Relic account ID to operate on. This allows the user to override the `account_id` attribute set on the provider. Defaults to the environment variable `NEW_RELIC_ACCOUNT_ID`.
102
- :param pulumi.Input[Sequence[pulumi.Input[int]]] channel_ids: An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs _cannot_ be imported.
104
+ :param pulumi.Input[str] account_id: The New Relic account ID to operate on. This allows the user to override the `account_id` attribute set on the provider. Defaults to the environment variable `NEW_RELIC_ACCOUNT_ID`.
105
+ :param pulumi.Input[Sequence[pulumi.Input[str]]] channel_ids: An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs _cannot_ be imported.
103
106
  :param pulumi.Input[str] incident_preference: The rollup strategy for the policy. Options include: `PER_POLICY`, `PER_CONDITION`, or `PER_CONDITION_AND_TARGET`. The default is `PER_POLICY`.
104
107
  :param pulumi.Input[str] name: The name of the policy.
105
108
  """
@@ -117,29 +120,27 @@ class _AlertPolicyState:
117
120
 
118
121
  @property
119
122
  @pulumi.getter(name="accountId")
120
- def account_id(self) -> Optional[pulumi.Input[int]]:
123
+ def account_id(self) -> Optional[pulumi.Input[str]]:
121
124
  """
122
125
  The New Relic account ID to operate on. This allows the user to override the `account_id` attribute set on the provider. Defaults to the environment variable `NEW_RELIC_ACCOUNT_ID`.
123
126
  """
124
127
  return pulumi.get(self, "account_id")
125
128
 
126
129
  @account_id.setter
127
- def account_id(self, value: Optional[pulumi.Input[int]]):
130
+ def account_id(self, value: Optional[pulumi.Input[str]]):
128
131
  pulumi.set(self, "account_id", value)
129
132
 
130
133
  @property
131
134
  @pulumi.getter(name="channelIds")
132
- def channel_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[int]]]]:
135
+ @_utilities.deprecated("""The `channel_ids` attribute is deprecated and will be removed in the next major release of the provider.""")
136
+ def channel_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
133
137
  """
134
138
  An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs _cannot_ be imported.
135
139
  """
136
- warnings.warn("""The `channel_ids` attribute is deprecated and will be removed in the next major release of the provider.""", DeprecationWarning)
137
- pulumi.log.warn("""channel_ids is deprecated: The `channel_ids` attribute is deprecated and will be removed in the next major release of the provider.""")
138
-
139
140
  return pulumi.get(self, "channel_ids")
140
141
 
141
142
  @channel_ids.setter
142
- def channel_ids(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[int]]]]):
143
+ def channel_ids(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
143
144
  pulumi.set(self, "channel_ids", value)
144
145
 
145
146
  @property
@@ -172,8 +173,8 @@ class AlertPolicy(pulumi.CustomResource):
172
173
  def __init__(__self__,
173
174
  resource_name: str,
174
175
  opts: Optional[pulumi.ResourceOptions] = None,
175
- account_id: Optional[pulumi.Input[int]] = None,
176
- channel_ids: Optional[pulumi.Input[Sequence[pulumi.Input[int]]]] = None,
176
+ account_id: Optional[pulumi.Input[str]] = None,
177
+ channel_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
177
178
  incident_preference: Optional[pulumi.Input[str]] = None,
178
179
  name: Optional[pulumi.Input[str]] = None,
179
180
  __props__=None):
@@ -181,14 +182,18 @@ class AlertPolicy(pulumi.CustomResource):
181
182
  Use this resource to create and manage New Relic alert policies.
182
183
 
183
184
  ## Example Usage
185
+
184
186
  ### Basic Usage
185
187
 
186
188
  ```python
187
189
  import pulumi
188
190
  import pulumi_newrelic as newrelic
189
191
 
190
- foo = newrelic.AlertPolicy("foo", incident_preference="PER_POLICY")
192
+ foo = newrelic.AlertPolicy("foo",
193
+ name="example",
194
+ incident_preference="PER_POLICY")
191
195
  ```
196
+
192
197
  ### Provision multiple notification channels and add those channels to a policy
193
198
 
194
199
  The following arguments are supported:
@@ -200,6 +205,7 @@ class AlertPolicy(pulumi.CustomResource):
200
205
  * `PER_CONDITION_AND_TARGET` - This sets the incident grouping preference of the policy to **One issue per condition and signal**. Refer to [this page](https://docs.newrelic.com/docs/alerts-applied-intelligence/new-relic-alerts/alert-policies/specify-when-alerts-create-incidents/#preference-signal) for more details on this incident grouping preference.
201
206
  * `channel_ids` - (Optional) **DEPRECATED** The `channel_ids` argument is deprecated and will be removed in the next major release of the provider. An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs _cannot_ be imported via `pulumi import` (see Import for info).
202
207
  * `account_id` - (Optional) The New Relic account ID to operate on. This allows the user to override the `account_id` attribute set on the provider. Defaults to the environment variable `NEW_RELIC_ACCOUNT_ID`.
208
+
203
209
  ## Additional Examples
204
210
 
205
211
  ##### Provision multiple notification channels and add those channels to a policy
@@ -208,21 +214,24 @@ class AlertPolicy(pulumi.CustomResource):
208
214
  import pulumi_newrelic as newrelic
209
215
 
210
216
  # Provision a Slack notification channel.
211
- slack_channel = newrelic.AlertChannel("slackChannel",
217
+ slack_channel = newrelic.AlertChannel("slack_channel",
218
+ name="slack-example",
212
219
  type="slack",
213
- config=newrelic.AlertChannelConfigArgs(
214
- url="https://hooks.slack.com/services/xxxxxxx/yyyyyyyy",
215
- channel="example-alerts-channel",
216
- ))
220
+ config={
221
+ "url": "https://hooks.slack.com/services/xxxxxxx/yyyyyyyy",
222
+ "channel": "example-alerts-channel",
223
+ })
217
224
  # Provision an email notification channel.
218
- email_channel = newrelic.AlertChannel("emailChannel",
225
+ email_channel = newrelic.AlertChannel("email_channel",
226
+ name="email-example",
219
227
  type="email",
220
- config=newrelic.AlertChannelConfigArgs(
221
- recipients="example@testing.com",
222
- include_json_attachment="1",
223
- ))
228
+ config={
229
+ "recipients": "example@testing.com",
230
+ "include_json_attachment": "1",
231
+ })
224
232
  # Provision the alert policy.
225
- policy_with_channels = newrelic.AlertPolicy("policyWithChannels",
233
+ policy_with_channels = newrelic.AlertPolicy("policy_with_channels",
234
+ name="example-with-channels",
226
235
  incident_preference="PER_CONDITION",
227
236
  channel_ids=[
228
237
  slack_channel.id,
@@ -235,10 +244,13 @@ class AlertPolicy(pulumi.CustomResource):
235
244
  import pulumi
236
245
  import pulumi_newrelic as newrelic
237
246
 
247
+ # Reference an existing Slack notification channel.
238
248
  slack_channel = newrelic.get_alert_channel(name="slack-channel-notification")
249
+ # Reference an existing email notification channel.
239
250
  email_channel = newrelic.get_alert_channel(name="test@example.com")
240
251
  # Provision the alert policy.
241
- policy_with_channels = newrelic.AlertPolicy("policyWithChannels",
252
+ policy_with_channels = newrelic.AlertPolicy("policy_with_channels",
253
+ name="example-with-channels",
242
254
  incident_preference="PER_CONDITION",
243
255
  channel_ids=[
244
256
  slack_channel.id,
@@ -253,14 +265,14 @@ class AlertPolicy(pulumi.CustomResource):
253
265
  Example import:
254
266
 
255
267
  ```sh
256
- $ pulumi import newrelic:index/alertPolicy:AlertPolicy foo 23423556:4593020
268
+ $ pulumi import newrelic:index/alertPolicy:AlertPolicy foo 23423556:4593020
257
269
  ```
258
- Please note that channel IDs (`channel_ids`) _cannot_ be imported due channels being a separate resource. However, to add channels to an imported alert policy, you can import the policy, add the `channel_ids` attribute with the associated channel IDs, then run `pulumi up`. This will result in the original alert policy being destroyed and a new alert policy being created along with the channels being added to the policy.
270
+ Please note that channel IDs (`channel_ids`) _cannot_ be imported due channels being a separate resource. However, to add channels to an imported alert policy, you can import the policy, add the `channel_ids` attribute with the associated channel IDs, then run `pulumi up`. This will result in the original alert policy being destroyed and a new alert policy being created along with the channels being added to the policy.
259
271
 
260
272
  :param str resource_name: The name of the resource.
261
273
  :param pulumi.ResourceOptions opts: Options for the resource.
262
- :param pulumi.Input[int] account_id: The New Relic account ID to operate on. This allows the user to override the `account_id` attribute set on the provider. Defaults to the environment variable `NEW_RELIC_ACCOUNT_ID`.
263
- :param pulumi.Input[Sequence[pulumi.Input[int]]] channel_ids: An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs _cannot_ be imported.
274
+ :param pulumi.Input[str] account_id: The New Relic account ID to operate on. This allows the user to override the `account_id` attribute set on the provider. Defaults to the environment variable `NEW_RELIC_ACCOUNT_ID`.
275
+ :param pulumi.Input[Sequence[pulumi.Input[str]]] channel_ids: An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs _cannot_ be imported.
264
276
  :param pulumi.Input[str] incident_preference: The rollup strategy for the policy. Options include: `PER_POLICY`, `PER_CONDITION`, or `PER_CONDITION_AND_TARGET`. The default is `PER_POLICY`.
265
277
  :param pulumi.Input[str] name: The name of the policy.
266
278
  """
@@ -274,14 +286,18 @@ class AlertPolicy(pulumi.CustomResource):
274
286
  Use this resource to create and manage New Relic alert policies.
275
287
 
276
288
  ## Example Usage
289
+
277
290
  ### Basic Usage
278
291
 
279
292
  ```python
280
293
  import pulumi
281
294
  import pulumi_newrelic as newrelic
282
295
 
283
- foo = newrelic.AlertPolicy("foo", incident_preference="PER_POLICY")
296
+ foo = newrelic.AlertPolicy("foo",
297
+ name="example",
298
+ incident_preference="PER_POLICY")
284
299
  ```
300
+
285
301
  ### Provision multiple notification channels and add those channels to a policy
286
302
 
287
303
  The following arguments are supported:
@@ -293,6 +309,7 @@ class AlertPolicy(pulumi.CustomResource):
293
309
  * `PER_CONDITION_AND_TARGET` - This sets the incident grouping preference of the policy to **One issue per condition and signal**. Refer to [this page](https://docs.newrelic.com/docs/alerts-applied-intelligence/new-relic-alerts/alert-policies/specify-when-alerts-create-incidents/#preference-signal) for more details on this incident grouping preference.
294
310
  * `channel_ids` - (Optional) **DEPRECATED** The `channel_ids` argument is deprecated and will be removed in the next major release of the provider. An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs _cannot_ be imported via `pulumi import` (see Import for info).
295
311
  * `account_id` - (Optional) The New Relic account ID to operate on. This allows the user to override the `account_id` attribute set on the provider. Defaults to the environment variable `NEW_RELIC_ACCOUNT_ID`.
312
+
296
313
  ## Additional Examples
297
314
 
298
315
  ##### Provision multiple notification channels and add those channels to a policy
@@ -301,21 +318,24 @@ class AlertPolicy(pulumi.CustomResource):
301
318
  import pulumi_newrelic as newrelic
302
319
 
303
320
  # Provision a Slack notification channel.
304
- slack_channel = newrelic.AlertChannel("slackChannel",
321
+ slack_channel = newrelic.AlertChannel("slack_channel",
322
+ name="slack-example",
305
323
  type="slack",
306
- config=newrelic.AlertChannelConfigArgs(
307
- url="https://hooks.slack.com/services/xxxxxxx/yyyyyyyy",
308
- channel="example-alerts-channel",
309
- ))
324
+ config={
325
+ "url": "https://hooks.slack.com/services/xxxxxxx/yyyyyyyy",
326
+ "channel": "example-alerts-channel",
327
+ })
310
328
  # Provision an email notification channel.
311
- email_channel = newrelic.AlertChannel("emailChannel",
329
+ email_channel = newrelic.AlertChannel("email_channel",
330
+ name="email-example",
312
331
  type="email",
313
- config=newrelic.AlertChannelConfigArgs(
314
- recipients="example@testing.com",
315
- include_json_attachment="1",
316
- ))
332
+ config={
333
+ "recipients": "example@testing.com",
334
+ "include_json_attachment": "1",
335
+ })
317
336
  # Provision the alert policy.
318
- policy_with_channels = newrelic.AlertPolicy("policyWithChannels",
337
+ policy_with_channels = newrelic.AlertPolicy("policy_with_channels",
338
+ name="example-with-channels",
319
339
  incident_preference="PER_CONDITION",
320
340
  channel_ids=[
321
341
  slack_channel.id,
@@ -328,10 +348,13 @@ class AlertPolicy(pulumi.CustomResource):
328
348
  import pulumi
329
349
  import pulumi_newrelic as newrelic
330
350
 
351
+ # Reference an existing Slack notification channel.
331
352
  slack_channel = newrelic.get_alert_channel(name="slack-channel-notification")
353
+ # Reference an existing email notification channel.
332
354
  email_channel = newrelic.get_alert_channel(name="test@example.com")
333
355
  # Provision the alert policy.
334
- policy_with_channels = newrelic.AlertPolicy("policyWithChannels",
356
+ policy_with_channels = newrelic.AlertPolicy("policy_with_channels",
357
+ name="example-with-channels",
335
358
  incident_preference="PER_CONDITION",
336
359
  channel_ids=[
337
360
  slack_channel.id,
@@ -346,9 +369,9 @@ class AlertPolicy(pulumi.CustomResource):
346
369
  Example import:
347
370
 
348
371
  ```sh
349
- $ pulumi import newrelic:index/alertPolicy:AlertPolicy foo 23423556:4593020
372
+ $ pulumi import newrelic:index/alertPolicy:AlertPolicy foo 23423556:4593020
350
373
  ```
351
- Please note that channel IDs (`channel_ids`) _cannot_ be imported due channels being a separate resource. However, to add channels to an imported alert policy, you can import the policy, add the `channel_ids` attribute with the associated channel IDs, then run `pulumi up`. This will result in the original alert policy being destroyed and a new alert policy being created along with the channels being added to the policy.
374
+ Please note that channel IDs (`channel_ids`) _cannot_ be imported due channels being a separate resource. However, to add channels to an imported alert policy, you can import the policy, add the `channel_ids` attribute with the associated channel IDs, then run `pulumi up`. This will result in the original alert policy being destroyed and a new alert policy being created along with the channels being added to the policy.
352
375
 
353
376
  :param str resource_name: The name of the resource.
354
377
  :param AlertPolicyArgs args: The arguments to use to populate this resource's properties.
@@ -365,8 +388,8 @@ class AlertPolicy(pulumi.CustomResource):
365
388
  def _internal_init(__self__,
366
389
  resource_name: str,
367
390
  opts: Optional[pulumi.ResourceOptions] = None,
368
- account_id: Optional[pulumi.Input[int]] = None,
369
- channel_ids: Optional[pulumi.Input[Sequence[pulumi.Input[int]]]] = None,
391
+ account_id: Optional[pulumi.Input[str]] = None,
392
+ channel_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
370
393
  incident_preference: Optional[pulumi.Input[str]] = None,
371
394
  name: Optional[pulumi.Input[str]] = None,
372
395
  __props__=None):
@@ -392,8 +415,8 @@ class AlertPolicy(pulumi.CustomResource):
392
415
  def get(resource_name: str,
393
416
  id: pulumi.Input[str],
394
417
  opts: Optional[pulumi.ResourceOptions] = None,
395
- account_id: Optional[pulumi.Input[int]] = None,
396
- channel_ids: Optional[pulumi.Input[Sequence[pulumi.Input[int]]]] = None,
418
+ account_id: Optional[pulumi.Input[str]] = None,
419
+ channel_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
397
420
  incident_preference: Optional[pulumi.Input[str]] = None,
398
421
  name: Optional[pulumi.Input[str]] = None) -> 'AlertPolicy':
399
422
  """
@@ -403,8 +426,8 @@ class AlertPolicy(pulumi.CustomResource):
403
426
  :param str resource_name: The unique name of the resulting resource.
404
427
  :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
405
428
  :param pulumi.ResourceOptions opts: Options for the resource.
406
- :param pulumi.Input[int] account_id: The New Relic account ID to operate on. This allows the user to override the `account_id` attribute set on the provider. Defaults to the environment variable `NEW_RELIC_ACCOUNT_ID`.
407
- :param pulumi.Input[Sequence[pulumi.Input[int]]] channel_ids: An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs _cannot_ be imported.
429
+ :param pulumi.Input[str] account_id: The New Relic account ID to operate on. This allows the user to override the `account_id` attribute set on the provider. Defaults to the environment variable `NEW_RELIC_ACCOUNT_ID`.
430
+ :param pulumi.Input[Sequence[pulumi.Input[str]]] channel_ids: An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs _cannot_ be imported.
408
431
  :param pulumi.Input[str] incident_preference: The rollup strategy for the policy. Options include: `PER_POLICY`, `PER_CONDITION`, or `PER_CONDITION_AND_TARGET`. The default is `PER_POLICY`.
409
432
  :param pulumi.Input[str] name: The name of the policy.
410
433
  """
@@ -420,7 +443,7 @@ class AlertPolicy(pulumi.CustomResource):
420
443
 
421
444
  @property
422
445
  @pulumi.getter(name="accountId")
423
- def account_id(self) -> pulumi.Output[int]:
446
+ def account_id(self) -> pulumi.Output[str]:
424
447
  """
425
448
  The New Relic account ID to operate on. This allows the user to override the `account_id` attribute set on the provider. Defaults to the environment variable `NEW_RELIC_ACCOUNT_ID`.
426
449
  """
@@ -428,13 +451,11 @@ class AlertPolicy(pulumi.CustomResource):
428
451
 
429
452
  @property
430
453
  @pulumi.getter(name="channelIds")
431
- def channel_ids(self) -> pulumi.Output[Optional[Sequence[int]]]:
454
+ @_utilities.deprecated("""The `channel_ids` attribute is deprecated and will be removed in the next major release of the provider.""")
455
+ def channel_ids(self) -> pulumi.Output[Optional[Sequence[str]]]:
432
456
  """
433
457
  An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs _cannot_ be imported.
434
458
  """
435
- warnings.warn("""The `channel_ids` attribute is deprecated and will be removed in the next major release of the provider.""", DeprecationWarning)
436
- pulumi.log.warn("""channel_ids is deprecated: The `channel_ids` attribute is deprecated and will be removed in the next major release of the provider.""")
437
-
438
459
  return pulumi.get(self, "channel_ids")
439
460
 
440
461
  @property