From a105dcf9d5e0eb18642440c91a483edbf07149b3 Mon Sep 17 00:00:00 2001 From: "bot@pulumi.com" Date: Wed, 18 Dec 2024 03:14:42 +0000 Subject: [PATCH 1/2] make tfgen --- patches/0001-fork.patch | 4 +- .../pulumi-resource-ns1/bridge-metadata.json | 15 ++ provider/cmd/pulumi-resource-ns1/schema.json | 157 ++++++++++++++++++ provider/go.mod | 2 +- provider/go.sum | 4 +- upstream | 2 +- 6 files changed, 178 insertions(+), 6 deletions(-) diff --git a/patches/0001-fork.patch b/patches/0001-fork.patch index 35d1b3d..93efe68 100644 --- a/patches/0001-fork.patch +++ b/patches/0001-fork.patch @@ -5,7 +5,7 @@ Subject: [PATCH] fork diff --git a/go.mod b/go.mod -index 41856e9..4243ab5 100644 +index 2e027ee..2c7e6d6 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ @@ -28,7 +28,7 @@ index 97093e2..dd93b8b 100644 func main() { diff --git a/ns1/resource_record.go b/ns1/resource_record.go -index 2376c78..0fb522a 100644 +index 540071e..cc9efbe 100644 --- a/ns1/resource_record.go +++ b/ns1/resource_record.go @@ -102,14 +102,7 @@ func recordResource() *schema.Resource { diff --git a/provider/cmd/pulumi-resource-ns1/bridge-metadata.json b/provider/cmd/pulumi-resource-ns1/bridge-metadata.json index 3ce2459..3eeb4e7 100644 --- a/provider/cmd/pulumi-resource-ns1/bridge-metadata.json +++ b/provider/cmd/pulumi-resource-ns1/bridge-metadata.json @@ -10,6 +10,21 @@ } } }, + "ns1_alert": { + "current": "ns1:index/alert:Alert", + "majorVersion": 3, + "fields": { + "notification_lists": { + "maxItemsOne": false + }, + "record_ids": { + "maxItemsOne": false + }, + "zone_names": { + "maxItemsOne": false + } + } + }, "ns1_apikey": { "current": "ns1:index/aPIKey:APIKey", "majorVersion": 3, diff --git a/provider/cmd/pulumi-resource-ns1/schema.json b/provider/cmd/pulumi-resource-ns1/schema.json index 34ba2d1..437b0cc 100644 --- a/provider/cmd/pulumi-resource-ns1/schema.json +++ b/provider/cmd/pulumi-resource-ns1/schema.json @@ -1435,6 +1435,163 @@ "type": "object" } }, + "ns1:index/alert:Alert": { + "description": "Provides a NS1 Alert resource. This can be used to create, modify, and delete alerts.\n\n## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as ns1 from \"@pulumi/ns1\";\n\nconst example = new ns1.Alert(\"example\", {\n name: \"Example Alert\",\n type: \"zone\",\n subtype: \"transfer_failed\",\n notificationLists: [],\n zoneNames: [],\n recordIds: [],\n});\n```\n```python\nimport pulumi\nimport pulumi_ns1 as ns1\n\nexample = ns1.Alert(\"example\",\n name=\"Example Alert\",\n type=\"zone\",\n subtype=\"transfer_failed\",\n notification_lists=[],\n zone_names=[],\n record_ids=[])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Ns1 = Pulumi.Ns1;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Ns1.Alert(\"example\", new()\n {\n Name = \"Example Alert\",\n Type = \"zone\",\n Subtype = \"transfer_failed\",\n NotificationLists = new[] {},\n ZoneNames = new[] {},\n RecordIds = new[] {},\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-ns1/sdk/v3/go/ns1\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := ns1.NewAlert(ctx, \"example\", \u0026ns1.AlertArgs{\n\t\t\tName: pulumi.String(\"Example Alert\"),\n\t\t\tType: pulumi.String(\"zone\"),\n\t\t\tSubtype: pulumi.String(\"transfer_failed\"),\n\t\t\tNotificationLists: pulumi.StringArray{},\n\t\t\tZoneNames: pulumi.StringArray{},\n\t\t\tRecordIds: pulumi.StringArray{},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.ns1.Alert;\nimport com.pulumi.ns1.AlertArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var example = new Alert(\"example\", AlertArgs.builder()\n .name(\"Example Alert\")\n .type(\"zone\")\n .subtype(\"transfer_failed\")\n .notificationLists()\n .zoneNames()\n .recordIds()\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: ns1:Alert\n properties:\n name: Example Alert\n type: zone\n subtype: transfer_failed\n notificationLists: []\n zoneNames: []\n recordIds: []\n```\n\u003c!--End PulumiCodeChooser --\u003e\n\n## NS1 Documentation\n\n[Alerts Api Doc](https://ns1.com/api#alerts)\n\n## Import\n\n```sh\n$ pulumi import ns1:index/alert:Alert \u003cname\u003e \u003calert_id\u003e`\n```\n\n", + "properties": { + "createdAt": { + "type": "integer", + "description": "(Read Only) The Unix timestamp representing when the alert configuration was created.\n" + }, + "createdBy": { + "type": "string", + "description": "(Read Only) The user or apikey that created this alert.\n" + }, + "name": { + "type": "string", + "description": "The free-form display name for the alert.\n" + }, + "notificationLists": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of id's for notification lists whose notifiers will be triggered by the alert.\n" + }, + "recordIds": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of record id's this alert applies to.\n" + }, + "subtype": { + "type": "string", + "description": "The type of the alert.\n" + }, + "type": { + "type": "string", + "description": "The type of the alert.\n" + }, + "updatedAt": { + "type": "integer", + "description": "(Read Only) The Unix timestamp representing when the alert configuration was last modified.\n" + }, + "updatedBy": { + "type": "string", + "description": "(Read Only) The user or apikey that last modified this alert.\n" + }, + "zoneNames": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of zones this alert applies to.\n" + } + }, + "required": [ + "createdAt", + "createdBy", + "name", + "subtype", + "type", + "updatedAt", + "updatedBy" + ], + "inputProperties": { + "name": { + "type": "string", + "description": "The free-form display name for the alert.\n" + }, + "notificationLists": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of id's for notification lists whose notifiers will be triggered by the alert.\n" + }, + "recordIds": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of record id's this alert applies to.\n" + }, + "subtype": { + "type": "string", + "description": "The type of the alert.\n" + }, + "type": { + "type": "string", + "description": "The type of the alert.\n" + }, + "zoneNames": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of zones this alert applies to.\n" + } + }, + "requiredInputs": [ + "subtype", + "type" + ], + "stateInputs": { + "description": "Input properties used for looking up and filtering Alert resources.\n", + "properties": { + "createdAt": { + "type": "integer", + "description": "(Read Only) The Unix timestamp representing when the alert configuration was created.\n" + }, + "createdBy": { + "type": "string", + "description": "(Read Only) The user or apikey that created this alert.\n" + }, + "name": { + "type": "string", + "description": "The free-form display name for the alert.\n" + }, + "notificationLists": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of id's for notification lists whose notifiers will be triggered by the alert.\n" + }, + "recordIds": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of record id's this alert applies to.\n" + }, + "subtype": { + "type": "string", + "description": "The type of the alert.\n" + }, + "type": { + "type": "string", + "description": "The type of the alert.\n" + }, + "updatedAt": { + "type": "integer", + "description": "(Read Only) The Unix timestamp representing when the alert configuration was last modified.\n" + }, + "updatedBy": { + "type": "string", + "description": "(Read Only) The user or apikey that last modified this alert.\n" + }, + "zoneNames": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of zones this alert applies to.\n" + } + }, + "type": "object" + } + }, "ns1:index/application:Application": { "description": "Provides a NS1 Pulsar application resource. This can be used to create, modify, and delete applications.\n\n## Import\n\n```sh\n$ pulumi import ns1:index/application:Application `ns1_application`\n```\n\nSo for the example above:\n\n```sh\n$ pulumi import ns1:index/application:Application example terraform.example.io`\n```\n\n", "properties": { diff --git a/provider/go.mod b/provider/go.mod index 42d66ac..1f72dd2 100644 --- a/provider/go.mod +++ b/provider/go.mod @@ -199,7 +199,7 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/grpc v1.67.1 // indirect google.golang.org/protobuf v1.35.1 // indirect - gopkg.in/ns1/ns1-go.v2 v2.12.2 // indirect + gopkg.in/ns1/ns1-go.v2 v2.13.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/frand v1.4.2 // indirect diff --git a/provider/go.sum b/provider/go.sum index 6368f65..3e866e8 100644 --- a/provider/go.sum +++ b/provider/go.sum @@ -2952,8 +2952,8 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ns1/ns1-go.v2 v2.12.2 h1:SPM5BTTMJ1zVBhMMiiPFdF7l6Y3fq5o7bKM7jDqsUfM= -gopkg.in/ns1/ns1-go.v2 v2.12.2/go.mod h1:pfaU0vECVP7DIOr453z03HXS6dFJpXdNRwOyRzwmPSc= +gopkg.in/ns1/ns1-go.v2 v2.13.0 h1:I5NNqI9Bi1SGK92TVkOvLTwux5LNrix/99H2datVh48= +gopkg.in/ns1/ns1-go.v2 v2.13.0/go.mod h1:pfaU0vECVP7DIOr453z03HXS6dFJpXdNRwOyRzwmPSc= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= diff --git a/upstream b/upstream index b0e7170..fde10b7 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit b0e7170dbc54ef9853e56005bd63d58acda4e083 +Subproject commit fde10b7dddb6f3024bae8c3c24c70c5de32ef94b From aa74b5446905ebb6bcd16bd915d6c314fb8437f0 Mon Sep 17 00:00:00 2001 From: "bot@pulumi.com" Date: Wed, 18 Dec 2024 03:16:44 +0000 Subject: [PATCH 2/2] make build_sdks --- sdk/dotnet/Alert.cs | 302 ++++++++++ sdk/go/ns1/alert.go | 382 ++++++++++++ sdk/go/ns1/init.go | 7 + .../src/main/java/com/pulumi/ns1/Alert.java | 271 +++++++++ .../main/java/com/pulumi/ns1/AlertArgs.java | 306 ++++++++++ .../com/pulumi/ns1/inputs/AlertState.java | 448 ++++++++++++++ sdk/nodejs/alert.ts | 226 +++++++ sdk/nodejs/index.ts | 8 + sdk/nodejs/tsconfig.json | 1 + sdk/python/pulumi_ns1/__init__.py | 9 + sdk/python/pulumi_ns1/alert.py | 549 ++++++++++++++++++ 11 files changed, 2509 insertions(+) create mode 100644 sdk/dotnet/Alert.cs create mode 100644 sdk/go/ns1/alert.go create mode 100644 sdk/java/src/main/java/com/pulumi/ns1/Alert.java create mode 100644 sdk/java/src/main/java/com/pulumi/ns1/AlertArgs.java create mode 100644 sdk/java/src/main/java/com/pulumi/ns1/inputs/AlertState.java create mode 100644 sdk/nodejs/alert.ts create mode 100644 sdk/python/pulumi_ns1/alert.py diff --git a/sdk/dotnet/Alert.cs b/sdk/dotnet/Alert.cs new file mode 100644 index 0000000..1d5cc01 --- /dev/null +++ b/sdk/dotnet/Alert.cs @@ -0,0 +1,302 @@ +// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading.Tasks; +using Pulumi.Serialization; + +namespace Pulumi.Ns1 +{ + /// + /// Provides a NS1 Alert resource. This can be used to create, modify, and delete alerts. + /// + /// ## Example Usage + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Ns1 = Pulumi.Ns1; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var example = new Ns1.Alert("example", new() + /// { + /// Name = "Example Alert", + /// Type = "zone", + /// Subtype = "transfer_failed", + /// NotificationLists = new[] {}, + /// ZoneNames = new[] {}, + /// RecordIds = new[] {}, + /// }); + /// + /// }); + /// ``` + /// + /// ## NS1 Documentation + /// + /// [Alerts Api Doc](https://ns1.com/api#alerts) + /// + /// ## Import + /// + /// ```sh + /// $ pulumi import ns1:index/alert:Alert <name> <alert_id>` + /// ``` + /// + [Ns1ResourceType("ns1:index/alert:Alert")] + public partial class Alert : global::Pulumi.CustomResource + { + /// + /// (Read Only) The Unix timestamp representing when the alert configuration was created. + /// + [Output("createdAt")] + public Output CreatedAt { get; private set; } = null!; + + /// + /// (Read Only) The user or apikey that created this alert. + /// + [Output("createdBy")] + public Output CreatedBy { get; private set; } = null!; + + /// + /// The free-form display name for the alert. + /// + [Output("name")] + public Output Name { get; private set; } = null!; + + /// + /// A list of id's for notification lists whose notifiers will be triggered by the alert. + /// + [Output("notificationLists")] + public Output> NotificationLists { get; private set; } = null!; + + /// + /// A list of record id's this alert applies to. + /// + [Output("recordIds")] + public Output> RecordIds { get; private set; } = null!; + + /// + /// The type of the alert. + /// + [Output("subtype")] + public Output Subtype { get; private set; } = null!; + + /// + /// The type of the alert. + /// + [Output("type")] + public Output Type { get; private set; } = null!; + + /// + /// (Read Only) The Unix timestamp representing when the alert configuration was last modified. + /// + [Output("updatedAt")] + public Output UpdatedAt { get; private set; } = null!; + + /// + /// (Read Only) The user or apikey that last modified this alert. + /// + [Output("updatedBy")] + public Output UpdatedBy { get; private set; } = null!; + + /// + /// A list of zones this alert applies to. + /// + [Output("zoneNames")] + public Output> ZoneNames { get; private set; } = null!; + + + /// + /// Create a Alert resource with the given unique name, arguments, and options. + /// + /// + /// The unique name of the resource + /// The arguments used to populate this resource's properties + /// A bag of options that control this resource's behavior + public Alert(string name, AlertArgs args, CustomResourceOptions? options = null) + : base("ns1:index/alert:Alert", name, args ?? new AlertArgs(), MakeResourceOptions(options, "")) + { + } + + private Alert(string name, Input id, AlertState? state = null, CustomResourceOptions? options = null) + : base("ns1:index/alert:Alert", name, state, MakeResourceOptions(options, id)) + { + } + + private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input? id) + { + var defaultOptions = new CustomResourceOptions + { + Version = Utilities.Version, + }; + var merged = CustomResourceOptions.Merge(defaultOptions, options); + // Override the ID if one was specified for consistency with other language SDKs. + merged.Id = id ?? merged.Id; + return merged; + } + /// + /// Get an existing Alert resource's state with the given name, ID, and optional extra + /// properties used to qualify the lookup. + /// + /// + /// The unique name of the resulting resource. + /// The unique provider ID of the resource to lookup. + /// Any extra arguments used during the lookup. + /// A bag of options that control this resource's behavior + public static Alert Get(string name, Input id, AlertState? state = null, CustomResourceOptions? options = null) + { + return new Alert(name, id, state, options); + } + } + + public sealed class AlertArgs : global::Pulumi.ResourceArgs + { + /// + /// The free-form display name for the alert. + /// + [Input("name")] + public Input? Name { get; set; } + + [Input("notificationLists")] + private InputList? _notificationLists; + + /// + /// A list of id's for notification lists whose notifiers will be triggered by the alert. + /// + public InputList NotificationLists + { + get => _notificationLists ?? (_notificationLists = new InputList()); + set => _notificationLists = value; + } + + [Input("recordIds")] + private InputList? _recordIds; + + /// + /// A list of record id's this alert applies to. + /// + public InputList RecordIds + { + get => _recordIds ?? (_recordIds = new InputList()); + set => _recordIds = value; + } + + /// + /// The type of the alert. + /// + [Input("subtype", required: true)] + public Input Subtype { get; set; } = null!; + + /// + /// The type of the alert. + /// + [Input("type", required: true)] + public Input Type { get; set; } = null!; + + [Input("zoneNames")] + private InputList? _zoneNames; + + /// + /// A list of zones this alert applies to. + /// + public InputList ZoneNames + { + get => _zoneNames ?? (_zoneNames = new InputList()); + set => _zoneNames = value; + } + + public AlertArgs() + { + } + public static new AlertArgs Empty => new AlertArgs(); + } + + public sealed class AlertState : global::Pulumi.ResourceArgs + { + /// + /// (Read Only) The Unix timestamp representing when the alert configuration was created. + /// + [Input("createdAt")] + public Input? CreatedAt { get; set; } + + /// + /// (Read Only) The user or apikey that created this alert. + /// + [Input("createdBy")] + public Input? CreatedBy { get; set; } + + /// + /// The free-form display name for the alert. + /// + [Input("name")] + public Input? Name { get; set; } + + [Input("notificationLists")] + private InputList? _notificationLists; + + /// + /// A list of id's for notification lists whose notifiers will be triggered by the alert. + /// + public InputList NotificationLists + { + get => _notificationLists ?? (_notificationLists = new InputList()); + set => _notificationLists = value; + } + + [Input("recordIds")] + private InputList? _recordIds; + + /// + /// A list of record id's this alert applies to. + /// + public InputList RecordIds + { + get => _recordIds ?? (_recordIds = new InputList()); + set => _recordIds = value; + } + + /// + /// The type of the alert. + /// + [Input("subtype")] + public Input? Subtype { get; set; } + + /// + /// The type of the alert. + /// + [Input("type")] + public Input? Type { get; set; } + + /// + /// (Read Only) The Unix timestamp representing when the alert configuration was last modified. + /// + [Input("updatedAt")] + public Input? UpdatedAt { get; set; } + + /// + /// (Read Only) The user or apikey that last modified this alert. + /// + [Input("updatedBy")] + public Input? UpdatedBy { get; set; } + + [Input("zoneNames")] + private InputList? _zoneNames; + + /// + /// A list of zones this alert applies to. + /// + public InputList ZoneNames + { + get => _zoneNames ?? (_zoneNames = new InputList()); + set => _zoneNames = value; + } + + public AlertState() + { + } + public static new AlertState Empty => new AlertState(); + } +} diff --git a/sdk/go/ns1/alert.go b/sdk/go/ns1/alert.go new file mode 100644 index 0000000..7d1ce70 --- /dev/null +++ b/sdk/go/ns1/alert.go @@ -0,0 +1,382 @@ +// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. +// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** + +package ns1 + +import ( + "context" + "reflect" + + "errors" + "github.com/pulumi/pulumi-ns1/sdk/v3/go/ns1/internal" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +) + +// Provides a NS1 Alert resource. This can be used to create, modify, and delete alerts. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-ns1/sdk/v3/go/ns1" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := ns1.NewAlert(ctx, "example", &ns1.AlertArgs{ +// Name: pulumi.String("Example Alert"), +// Type: pulumi.String("zone"), +// Subtype: pulumi.String("transfer_failed"), +// NotificationLists: pulumi.StringArray{}, +// ZoneNames: pulumi.StringArray{}, +// RecordIds: pulumi.StringArray{}, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// ## NS1 Documentation +// +// [Alerts Api Doc](https://ns1.com/api#alerts) +// +// ## Import +// +// ```sh +// $ pulumi import ns1:index/alert:Alert ` +// ``` +type Alert struct { + pulumi.CustomResourceState + + // (Read Only) The Unix timestamp representing when the alert configuration was created. + CreatedAt pulumi.IntOutput `pulumi:"createdAt"` + // (Read Only) The user or apikey that created this alert. + CreatedBy pulumi.StringOutput `pulumi:"createdBy"` + // The free-form display name for the alert. + Name pulumi.StringOutput `pulumi:"name"` + // A list of id's for notification lists whose notifiers will be triggered by the alert. + NotificationLists pulumi.StringArrayOutput `pulumi:"notificationLists"` + // A list of record id's this alert applies to. + RecordIds pulumi.StringArrayOutput `pulumi:"recordIds"` + // The type of the alert. + Subtype pulumi.StringOutput `pulumi:"subtype"` + // The type of the alert. + Type pulumi.StringOutput `pulumi:"type"` + // (Read Only) The Unix timestamp representing when the alert configuration was last modified. + UpdatedAt pulumi.IntOutput `pulumi:"updatedAt"` + // (Read Only) The user or apikey that last modified this alert. + UpdatedBy pulumi.StringOutput `pulumi:"updatedBy"` + // A list of zones this alert applies to. + ZoneNames pulumi.StringArrayOutput `pulumi:"zoneNames"` +} + +// NewAlert registers a new resource with the given unique name, arguments, and options. +func NewAlert(ctx *pulumi.Context, + name string, args *AlertArgs, opts ...pulumi.ResourceOption) (*Alert, error) { + if args == nil { + return nil, errors.New("missing one or more required arguments") + } + + if args.Subtype == nil { + return nil, errors.New("invalid value for required argument 'Subtype'") + } + if args.Type == nil { + return nil, errors.New("invalid value for required argument 'Type'") + } + opts = internal.PkgResourceDefaultOpts(opts) + var resource Alert + err := ctx.RegisterResource("ns1:index/alert:Alert", name, args, &resource, opts...) + if err != nil { + return nil, err + } + return &resource, nil +} + +// GetAlert gets an existing Alert resource's state with the given name, ID, and optional +// state properties that are used to uniquely qualify the lookup (nil if not required). +func GetAlert(ctx *pulumi.Context, + name string, id pulumi.IDInput, state *AlertState, opts ...pulumi.ResourceOption) (*Alert, error) { + var resource Alert + err := ctx.ReadResource("ns1:index/alert:Alert", name, id, state, &resource, opts...) + if err != nil { + return nil, err + } + return &resource, nil +} + +// Input properties used for looking up and filtering Alert resources. +type alertState struct { + // (Read Only) The Unix timestamp representing when the alert configuration was created. + CreatedAt *int `pulumi:"createdAt"` + // (Read Only) The user or apikey that created this alert. + CreatedBy *string `pulumi:"createdBy"` + // The free-form display name for the alert. + Name *string `pulumi:"name"` + // A list of id's for notification lists whose notifiers will be triggered by the alert. + NotificationLists []string `pulumi:"notificationLists"` + // A list of record id's this alert applies to. + RecordIds []string `pulumi:"recordIds"` + // The type of the alert. + Subtype *string `pulumi:"subtype"` + // The type of the alert. + Type *string `pulumi:"type"` + // (Read Only) The Unix timestamp representing when the alert configuration was last modified. + UpdatedAt *int `pulumi:"updatedAt"` + // (Read Only) The user or apikey that last modified this alert. + UpdatedBy *string `pulumi:"updatedBy"` + // A list of zones this alert applies to. + ZoneNames []string `pulumi:"zoneNames"` +} + +type AlertState struct { + // (Read Only) The Unix timestamp representing when the alert configuration was created. + CreatedAt pulumi.IntPtrInput + // (Read Only) The user or apikey that created this alert. + CreatedBy pulumi.StringPtrInput + // The free-form display name for the alert. + Name pulumi.StringPtrInput + // A list of id's for notification lists whose notifiers will be triggered by the alert. + NotificationLists pulumi.StringArrayInput + // A list of record id's this alert applies to. + RecordIds pulumi.StringArrayInput + // The type of the alert. + Subtype pulumi.StringPtrInput + // The type of the alert. + Type pulumi.StringPtrInput + // (Read Only) The Unix timestamp representing when the alert configuration was last modified. + UpdatedAt pulumi.IntPtrInput + // (Read Only) The user or apikey that last modified this alert. + UpdatedBy pulumi.StringPtrInput + // A list of zones this alert applies to. + ZoneNames pulumi.StringArrayInput +} + +func (AlertState) ElementType() reflect.Type { + return reflect.TypeOf((*alertState)(nil)).Elem() +} + +type alertArgs struct { + // The free-form display name for the alert. + Name *string `pulumi:"name"` + // A list of id's for notification lists whose notifiers will be triggered by the alert. + NotificationLists []string `pulumi:"notificationLists"` + // A list of record id's this alert applies to. + RecordIds []string `pulumi:"recordIds"` + // The type of the alert. + Subtype string `pulumi:"subtype"` + // The type of the alert. + Type string `pulumi:"type"` + // A list of zones this alert applies to. + ZoneNames []string `pulumi:"zoneNames"` +} + +// The set of arguments for constructing a Alert resource. +type AlertArgs struct { + // The free-form display name for the alert. + Name pulumi.StringPtrInput + // A list of id's for notification lists whose notifiers will be triggered by the alert. + NotificationLists pulumi.StringArrayInput + // A list of record id's this alert applies to. + RecordIds pulumi.StringArrayInput + // The type of the alert. + Subtype pulumi.StringInput + // The type of the alert. + Type pulumi.StringInput + // A list of zones this alert applies to. + ZoneNames pulumi.StringArrayInput +} + +func (AlertArgs) ElementType() reflect.Type { + return reflect.TypeOf((*alertArgs)(nil)).Elem() +} + +type AlertInput interface { + pulumi.Input + + ToAlertOutput() AlertOutput + ToAlertOutputWithContext(ctx context.Context) AlertOutput +} + +func (*Alert) ElementType() reflect.Type { + return reflect.TypeOf((**Alert)(nil)).Elem() +} + +func (i *Alert) ToAlertOutput() AlertOutput { + return i.ToAlertOutputWithContext(context.Background()) +} + +func (i *Alert) ToAlertOutputWithContext(ctx context.Context) AlertOutput { + return pulumi.ToOutputWithContext(ctx, i).(AlertOutput) +} + +// AlertArrayInput is an input type that accepts AlertArray and AlertArrayOutput values. +// You can construct a concrete instance of `AlertArrayInput` via: +// +// AlertArray{ AlertArgs{...} } +type AlertArrayInput interface { + pulumi.Input + + ToAlertArrayOutput() AlertArrayOutput + ToAlertArrayOutputWithContext(context.Context) AlertArrayOutput +} + +type AlertArray []AlertInput + +func (AlertArray) ElementType() reflect.Type { + return reflect.TypeOf((*[]*Alert)(nil)).Elem() +} + +func (i AlertArray) ToAlertArrayOutput() AlertArrayOutput { + return i.ToAlertArrayOutputWithContext(context.Background()) +} + +func (i AlertArray) ToAlertArrayOutputWithContext(ctx context.Context) AlertArrayOutput { + return pulumi.ToOutputWithContext(ctx, i).(AlertArrayOutput) +} + +// AlertMapInput is an input type that accepts AlertMap and AlertMapOutput values. +// You can construct a concrete instance of `AlertMapInput` via: +// +// AlertMap{ "key": AlertArgs{...} } +type AlertMapInput interface { + pulumi.Input + + ToAlertMapOutput() AlertMapOutput + ToAlertMapOutputWithContext(context.Context) AlertMapOutput +} + +type AlertMap map[string]AlertInput + +func (AlertMap) ElementType() reflect.Type { + return reflect.TypeOf((*map[string]*Alert)(nil)).Elem() +} + +func (i AlertMap) ToAlertMapOutput() AlertMapOutput { + return i.ToAlertMapOutputWithContext(context.Background()) +} + +func (i AlertMap) ToAlertMapOutputWithContext(ctx context.Context) AlertMapOutput { + return pulumi.ToOutputWithContext(ctx, i).(AlertMapOutput) +} + +type AlertOutput struct{ *pulumi.OutputState } + +func (AlertOutput) ElementType() reflect.Type { + return reflect.TypeOf((**Alert)(nil)).Elem() +} + +func (o AlertOutput) ToAlertOutput() AlertOutput { + return o +} + +func (o AlertOutput) ToAlertOutputWithContext(ctx context.Context) AlertOutput { + return o +} + +// (Read Only) The Unix timestamp representing when the alert configuration was created. +func (o AlertOutput) CreatedAt() pulumi.IntOutput { + return o.ApplyT(func(v *Alert) pulumi.IntOutput { return v.CreatedAt }).(pulumi.IntOutput) +} + +// (Read Only) The user or apikey that created this alert. +func (o AlertOutput) CreatedBy() pulumi.StringOutput { + return o.ApplyT(func(v *Alert) pulumi.StringOutput { return v.CreatedBy }).(pulumi.StringOutput) +} + +// The free-form display name for the alert. +func (o AlertOutput) Name() pulumi.StringOutput { + return o.ApplyT(func(v *Alert) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) +} + +// A list of id's for notification lists whose notifiers will be triggered by the alert. +func (o AlertOutput) NotificationLists() pulumi.StringArrayOutput { + return o.ApplyT(func(v *Alert) pulumi.StringArrayOutput { return v.NotificationLists }).(pulumi.StringArrayOutput) +} + +// A list of record id's this alert applies to. +func (o AlertOutput) RecordIds() pulumi.StringArrayOutput { + return o.ApplyT(func(v *Alert) pulumi.StringArrayOutput { return v.RecordIds }).(pulumi.StringArrayOutput) +} + +// The type of the alert. +func (o AlertOutput) Subtype() pulumi.StringOutput { + return o.ApplyT(func(v *Alert) pulumi.StringOutput { return v.Subtype }).(pulumi.StringOutput) +} + +// The type of the alert. +func (o AlertOutput) Type() pulumi.StringOutput { + return o.ApplyT(func(v *Alert) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput) +} + +// (Read Only) The Unix timestamp representing when the alert configuration was last modified. +func (o AlertOutput) UpdatedAt() pulumi.IntOutput { + return o.ApplyT(func(v *Alert) pulumi.IntOutput { return v.UpdatedAt }).(pulumi.IntOutput) +} + +// (Read Only) The user or apikey that last modified this alert. +func (o AlertOutput) UpdatedBy() pulumi.StringOutput { + return o.ApplyT(func(v *Alert) pulumi.StringOutput { return v.UpdatedBy }).(pulumi.StringOutput) +} + +// A list of zones this alert applies to. +func (o AlertOutput) ZoneNames() pulumi.StringArrayOutput { + return o.ApplyT(func(v *Alert) pulumi.StringArrayOutput { return v.ZoneNames }).(pulumi.StringArrayOutput) +} + +type AlertArrayOutput struct{ *pulumi.OutputState } + +func (AlertArrayOutput) ElementType() reflect.Type { + return reflect.TypeOf((*[]*Alert)(nil)).Elem() +} + +func (o AlertArrayOutput) ToAlertArrayOutput() AlertArrayOutput { + return o +} + +func (o AlertArrayOutput) ToAlertArrayOutputWithContext(ctx context.Context) AlertArrayOutput { + return o +} + +func (o AlertArrayOutput) Index(i pulumi.IntInput) AlertOutput { + return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Alert { + return vs[0].([]*Alert)[vs[1].(int)] + }).(AlertOutput) +} + +type AlertMapOutput struct{ *pulumi.OutputState } + +func (AlertMapOutput) ElementType() reflect.Type { + return reflect.TypeOf((*map[string]*Alert)(nil)).Elem() +} + +func (o AlertMapOutput) ToAlertMapOutput() AlertMapOutput { + return o +} + +func (o AlertMapOutput) ToAlertMapOutputWithContext(ctx context.Context) AlertMapOutput { + return o +} + +func (o AlertMapOutput) MapIndex(k pulumi.StringInput) AlertOutput { + return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Alert { + return vs[0].(map[string]*Alert)[vs[1].(string)] + }).(AlertOutput) +} + +func init() { + pulumi.RegisterInputType(reflect.TypeOf((*AlertInput)(nil)).Elem(), &Alert{}) + pulumi.RegisterInputType(reflect.TypeOf((*AlertArrayInput)(nil)).Elem(), AlertArray{}) + pulumi.RegisterInputType(reflect.TypeOf((*AlertMapInput)(nil)).Elem(), AlertMap{}) + pulumi.RegisterOutputType(AlertOutput{}) + pulumi.RegisterOutputType(AlertArrayOutput{}) + pulumi.RegisterOutputType(AlertMapOutput{}) +} diff --git a/sdk/go/ns1/init.go b/sdk/go/ns1/init.go index 4bbcdb2..aa4b085 100644 --- a/sdk/go/ns1/init.go +++ b/sdk/go/ns1/init.go @@ -25,6 +25,8 @@ func (m *module) Construct(ctx *pulumi.Context, name, typ, urn string) (r pulumi r = &APIKey{} case "ns1:index/accountWhitelist:AccountWhitelist": r = &AccountWhitelist{} + case "ns1:index/alert:Alert": + r = &Alert{} case "ns1:index/application:Application": r = &Application{} case "ns1:index/dataFeed:DataFeed": @@ -96,6 +98,11 @@ func init() { "index/accountWhitelist", &module{version}, ) + pulumi.RegisterResourceModule( + "ns1", + "index/alert", + &module{version}, + ) pulumi.RegisterResourceModule( "ns1", "index/application", diff --git a/sdk/java/src/main/java/com/pulumi/ns1/Alert.java b/sdk/java/src/main/java/com/pulumi/ns1/Alert.java new file mode 100644 index 0000000..9525e84 --- /dev/null +++ b/sdk/java/src/main/java/com/pulumi/ns1/Alert.java @@ -0,0 +1,271 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.ns1; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Export; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.ns1.AlertArgs; +import com.pulumi.ns1.Utilities; +import com.pulumi.ns1.inputs.AlertState; +import java.lang.Integer; +import java.lang.String; +import java.util.List; +import java.util.Optional; +import javax.annotation.Nullable; + +/** + * Provides a NS1 Alert resource. This can be used to create, modify, and delete alerts. + * + * ## Example Usage + * + * <!--Start PulumiCodeChooser --> + *
+ * {@code
+ * package generated_program;
+ * 
+ * import com.pulumi.Context;
+ * import com.pulumi.Pulumi;
+ * import com.pulumi.core.Output;
+ * import com.pulumi.ns1.Alert;
+ * import com.pulumi.ns1.AlertArgs;
+ * 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 example = new Alert("example", AlertArgs.builder()
+ *             .name("Example Alert")
+ *             .type("zone")
+ *             .subtype("transfer_failed")
+ *             .notificationLists()
+ *             .zoneNames()
+ *             .recordIds()
+ *             .build());
+ * 
+ *     }
+ * }
+ * }
+ * 
+ * <!--End PulumiCodeChooser --> + * + * ## NS1 Documentation + * + * [Alerts Api Doc](https://ns1.com/api#alerts) + * + * ## Import + * + * ```sh + * $ pulumi import ns1:index/alert:Alert <name> <alert_id>` + * ``` + * + */ +@ResourceType(type="ns1:index/alert:Alert") +public class Alert extends com.pulumi.resources.CustomResource { + /** + * (Read Only) The Unix timestamp representing when the alert configuration was created. + * + */ + @Export(name="createdAt", refs={Integer.class}, tree="[0]") + private Output createdAt; + + /** + * @return (Read Only) The Unix timestamp representing when the alert configuration was created. + * + */ + public Output createdAt() { + return this.createdAt; + } + /** + * (Read Only) The user or apikey that created this alert. + * + */ + @Export(name="createdBy", refs={String.class}, tree="[0]") + private Output createdBy; + + /** + * @return (Read Only) The user or apikey that created this alert. + * + */ + public Output createdBy() { + return this.createdBy; + } + /** + * The free-form display name for the alert. + * + */ + @Export(name="name", refs={String.class}, tree="[0]") + private Output name; + + /** + * @return The free-form display name for the alert. + * + */ + public Output name() { + return this.name; + } + /** + * A list of id's for notification lists whose notifiers will be triggered by the alert. + * + */ + @Export(name="notificationLists", refs={List.class,String.class}, tree="[0,1]") + private Output> notificationLists; + + /** + * @return A list of id's for notification lists whose notifiers will be triggered by the alert. + * + */ + public Output>> notificationLists() { + return Codegen.optional(this.notificationLists); + } + /** + * A list of record id's this alert applies to. + * + */ + @Export(name="recordIds", refs={List.class,String.class}, tree="[0,1]") + private Output> recordIds; + + /** + * @return A list of record id's this alert applies to. + * + */ + public Output>> recordIds() { + return Codegen.optional(this.recordIds); + } + /** + * The type of the alert. + * + */ + @Export(name="subtype", refs={String.class}, tree="[0]") + private Output subtype; + + /** + * @return The type of the alert. + * + */ + public Output subtype() { + return this.subtype; + } + /** + * The type of the alert. + * + */ + @Export(name="type", refs={String.class}, tree="[0]") + private Output type; + + /** + * @return The type of the alert. + * + */ + public Output type() { + return this.type; + } + /** + * (Read Only) The Unix timestamp representing when the alert configuration was last modified. + * + */ + @Export(name="updatedAt", refs={Integer.class}, tree="[0]") + private Output updatedAt; + + /** + * @return (Read Only) The Unix timestamp representing when the alert configuration was last modified. + * + */ + public Output updatedAt() { + return this.updatedAt; + } + /** + * (Read Only) The user or apikey that last modified this alert. + * + */ + @Export(name="updatedBy", refs={String.class}, tree="[0]") + private Output updatedBy; + + /** + * @return (Read Only) The user or apikey that last modified this alert. + * + */ + public Output updatedBy() { + return this.updatedBy; + } + /** + * A list of zones this alert applies to. + * + */ + @Export(name="zoneNames", refs={List.class,String.class}, tree="[0,1]") + private Output> zoneNames; + + /** + * @return A list of zones this alert applies to. + * + */ + public Output>> zoneNames() { + return Codegen.optional(this.zoneNames); + } + + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public Alert(java.lang.String name) { + this(name, AlertArgs.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public Alert(java.lang.String name, AlertArgs args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public Alert(java.lang.String name, AlertArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("ns1:index/alert:Alert", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); + } + + private Alert(java.lang.String name, Output id, @Nullable AlertState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("ns1:index/alert:Alert", name, state, makeResourceOptions(options, id), false); + } + + private static AlertArgs makeArgs(AlertArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { + if (options != null && options.getUrn().isPresent()) { + return null; + } + return args == null ? AlertArgs.Empty : args; + } + + private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); + } + + /** + * Get an existing Host resource's state with the given name, ID, and optional extra + * properties used to qualify the lookup. + * + * @param name The _unique_ name of the resulting resource. + * @param id The _unique_ provider ID of the resource to lookup. + * @param state + * @param options Optional settings to control the behavior of the CustomResource. + */ + public static Alert get(java.lang.String name, Output id, @Nullable AlertState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { + return new Alert(name, id, state, options); + } +} diff --git a/sdk/java/src/main/java/com/pulumi/ns1/AlertArgs.java b/sdk/java/src/main/java/com/pulumi/ns1/AlertArgs.java new file mode 100644 index 0000000..a5cde35 --- /dev/null +++ b/sdk/java/src/main/java/com/pulumi/ns1/AlertArgs.java @@ -0,0 +1,306 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.ns1; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import com.pulumi.exceptions.MissingRequiredPropertyException; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +public final class AlertArgs extends com.pulumi.resources.ResourceArgs { + + public static final AlertArgs Empty = new AlertArgs(); + + /** + * The free-form display name for the alert. + * + */ + @Import(name="name") + private @Nullable Output name; + + /** + * @return The free-form display name for the alert. + * + */ + public Optional> name() { + return Optional.ofNullable(this.name); + } + + /** + * A list of id's for notification lists whose notifiers will be triggered by the alert. + * + */ + @Import(name="notificationLists") + private @Nullable Output> notificationLists; + + /** + * @return A list of id's for notification lists whose notifiers will be triggered by the alert. + * + */ + public Optional>> notificationLists() { + return Optional.ofNullable(this.notificationLists); + } + + /** + * A list of record id's this alert applies to. + * + */ + @Import(name="recordIds") + private @Nullable Output> recordIds; + + /** + * @return A list of record id's this alert applies to. + * + */ + public Optional>> recordIds() { + return Optional.ofNullable(this.recordIds); + } + + /** + * The type of the alert. + * + */ + @Import(name="subtype", required=true) + private Output subtype; + + /** + * @return The type of the alert. + * + */ + public Output subtype() { + return this.subtype; + } + + /** + * The type of the alert. + * + */ + @Import(name="type", required=true) + private Output type; + + /** + * @return The type of the alert. + * + */ + public Output type() { + return this.type; + } + + /** + * A list of zones this alert applies to. + * + */ + @Import(name="zoneNames") + private @Nullable Output> zoneNames; + + /** + * @return A list of zones this alert applies to. + * + */ + public Optional>> zoneNames() { + return Optional.ofNullable(this.zoneNames); + } + + private AlertArgs() {} + + private AlertArgs(AlertArgs $) { + this.name = $.name; + this.notificationLists = $.notificationLists; + this.recordIds = $.recordIds; + this.subtype = $.subtype; + this.type = $.type; + this.zoneNames = $.zoneNames; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(AlertArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private AlertArgs $; + + public Builder() { + $ = new AlertArgs(); + } + + public Builder(AlertArgs defaults) { + $ = new AlertArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param name The free-form display name for the alert. + * + * @return builder + * + */ + public Builder name(@Nullable Output name) { + $.name = name; + return this; + } + + /** + * @param name The free-form display name for the alert. + * + * @return builder + * + */ + public Builder name(String name) { + return name(Output.of(name)); + } + + /** + * @param notificationLists A list of id's for notification lists whose notifiers will be triggered by the alert. + * + * @return builder + * + */ + public Builder notificationLists(@Nullable Output> notificationLists) { + $.notificationLists = notificationLists; + return this; + } + + /** + * @param notificationLists A list of id's for notification lists whose notifiers will be triggered by the alert. + * + * @return builder + * + */ + public Builder notificationLists(List notificationLists) { + return notificationLists(Output.of(notificationLists)); + } + + /** + * @param notificationLists A list of id's for notification lists whose notifiers will be triggered by the alert. + * + * @return builder + * + */ + public Builder notificationLists(String... notificationLists) { + return notificationLists(List.of(notificationLists)); + } + + /** + * @param recordIds A list of record id's this alert applies to. + * + * @return builder + * + */ + public Builder recordIds(@Nullable Output> recordIds) { + $.recordIds = recordIds; + return this; + } + + /** + * @param recordIds A list of record id's this alert applies to. + * + * @return builder + * + */ + public Builder recordIds(List recordIds) { + return recordIds(Output.of(recordIds)); + } + + /** + * @param recordIds A list of record id's this alert applies to. + * + * @return builder + * + */ + public Builder recordIds(String... recordIds) { + return recordIds(List.of(recordIds)); + } + + /** + * @param subtype The type of the alert. + * + * @return builder + * + */ + public Builder subtype(Output subtype) { + $.subtype = subtype; + return this; + } + + /** + * @param subtype The type of the alert. + * + * @return builder + * + */ + public Builder subtype(String subtype) { + return subtype(Output.of(subtype)); + } + + /** + * @param type The type of the alert. + * + * @return builder + * + */ + public Builder type(Output type) { + $.type = type; + return this; + } + + /** + * @param type The type of the alert. + * + * @return builder + * + */ + public Builder type(String type) { + return type(Output.of(type)); + } + + /** + * @param zoneNames A list of zones this alert applies to. + * + * @return builder + * + */ + public Builder zoneNames(@Nullable Output> zoneNames) { + $.zoneNames = zoneNames; + return this; + } + + /** + * @param zoneNames A list of zones this alert applies to. + * + * @return builder + * + */ + public Builder zoneNames(List zoneNames) { + return zoneNames(Output.of(zoneNames)); + } + + /** + * @param zoneNames A list of zones this alert applies to. + * + * @return builder + * + */ + public Builder zoneNames(String... zoneNames) { + return zoneNames(List.of(zoneNames)); + } + + public AlertArgs build() { + if ($.subtype == null) { + throw new MissingRequiredPropertyException("AlertArgs", "subtype"); + } + if ($.type == null) { + throw new MissingRequiredPropertyException("AlertArgs", "type"); + } + return $; + } + } + +} diff --git a/sdk/java/src/main/java/com/pulumi/ns1/inputs/AlertState.java b/sdk/java/src/main/java/com/pulumi/ns1/inputs/AlertState.java new file mode 100644 index 0000000..50e0e2e --- /dev/null +++ b/sdk/java/src/main/java/com/pulumi/ns1/inputs/AlertState.java @@ -0,0 +1,448 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.ns1.inputs; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import java.lang.Integer; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +public final class AlertState extends com.pulumi.resources.ResourceArgs { + + public static final AlertState Empty = new AlertState(); + + /** + * (Read Only) The Unix timestamp representing when the alert configuration was created. + * + */ + @Import(name="createdAt") + private @Nullable Output createdAt; + + /** + * @return (Read Only) The Unix timestamp representing when the alert configuration was created. + * + */ + public Optional> createdAt() { + return Optional.ofNullable(this.createdAt); + } + + /** + * (Read Only) The user or apikey that created this alert. + * + */ + @Import(name="createdBy") + private @Nullable Output createdBy; + + /** + * @return (Read Only) The user or apikey that created this alert. + * + */ + public Optional> createdBy() { + return Optional.ofNullable(this.createdBy); + } + + /** + * The free-form display name for the alert. + * + */ + @Import(name="name") + private @Nullable Output name; + + /** + * @return The free-form display name for the alert. + * + */ + public Optional> name() { + return Optional.ofNullable(this.name); + } + + /** + * A list of id's for notification lists whose notifiers will be triggered by the alert. + * + */ + @Import(name="notificationLists") + private @Nullable Output> notificationLists; + + /** + * @return A list of id's for notification lists whose notifiers will be triggered by the alert. + * + */ + public Optional>> notificationLists() { + return Optional.ofNullable(this.notificationLists); + } + + /** + * A list of record id's this alert applies to. + * + */ + @Import(name="recordIds") + private @Nullable Output> recordIds; + + /** + * @return A list of record id's this alert applies to. + * + */ + public Optional>> recordIds() { + return Optional.ofNullable(this.recordIds); + } + + /** + * The type of the alert. + * + */ + @Import(name="subtype") + private @Nullable Output subtype; + + /** + * @return The type of the alert. + * + */ + public Optional> subtype() { + return Optional.ofNullable(this.subtype); + } + + /** + * The type of the alert. + * + */ + @Import(name="type") + private @Nullable Output type; + + /** + * @return The type of the alert. + * + */ + public Optional> type() { + return Optional.ofNullable(this.type); + } + + /** + * (Read Only) The Unix timestamp representing when the alert configuration was last modified. + * + */ + @Import(name="updatedAt") + private @Nullable Output updatedAt; + + /** + * @return (Read Only) The Unix timestamp representing when the alert configuration was last modified. + * + */ + public Optional> updatedAt() { + return Optional.ofNullable(this.updatedAt); + } + + /** + * (Read Only) The user or apikey that last modified this alert. + * + */ + @Import(name="updatedBy") + private @Nullable Output updatedBy; + + /** + * @return (Read Only) The user or apikey that last modified this alert. + * + */ + public Optional> updatedBy() { + return Optional.ofNullable(this.updatedBy); + } + + /** + * A list of zones this alert applies to. + * + */ + @Import(name="zoneNames") + private @Nullable Output> zoneNames; + + /** + * @return A list of zones this alert applies to. + * + */ + public Optional>> zoneNames() { + return Optional.ofNullable(this.zoneNames); + } + + private AlertState() {} + + private AlertState(AlertState $) { + this.createdAt = $.createdAt; + this.createdBy = $.createdBy; + this.name = $.name; + this.notificationLists = $.notificationLists; + this.recordIds = $.recordIds; + this.subtype = $.subtype; + this.type = $.type; + this.updatedAt = $.updatedAt; + this.updatedBy = $.updatedBy; + this.zoneNames = $.zoneNames; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(AlertState defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private AlertState $; + + public Builder() { + $ = new AlertState(); + } + + public Builder(AlertState defaults) { + $ = new AlertState(Objects.requireNonNull(defaults)); + } + + /** + * @param createdAt (Read Only) The Unix timestamp representing when the alert configuration was created. + * + * @return builder + * + */ + public Builder createdAt(@Nullable Output createdAt) { + $.createdAt = createdAt; + return this; + } + + /** + * @param createdAt (Read Only) The Unix timestamp representing when the alert configuration was created. + * + * @return builder + * + */ + public Builder createdAt(Integer createdAt) { + return createdAt(Output.of(createdAt)); + } + + /** + * @param createdBy (Read Only) The user or apikey that created this alert. + * + * @return builder + * + */ + public Builder createdBy(@Nullable Output createdBy) { + $.createdBy = createdBy; + return this; + } + + /** + * @param createdBy (Read Only) The user or apikey that created this alert. + * + * @return builder + * + */ + public Builder createdBy(String createdBy) { + return createdBy(Output.of(createdBy)); + } + + /** + * @param name The free-form display name for the alert. + * + * @return builder + * + */ + public Builder name(@Nullable Output name) { + $.name = name; + return this; + } + + /** + * @param name The free-form display name for the alert. + * + * @return builder + * + */ + public Builder name(String name) { + return name(Output.of(name)); + } + + /** + * @param notificationLists A list of id's for notification lists whose notifiers will be triggered by the alert. + * + * @return builder + * + */ + public Builder notificationLists(@Nullable Output> notificationLists) { + $.notificationLists = notificationLists; + return this; + } + + /** + * @param notificationLists A list of id's for notification lists whose notifiers will be triggered by the alert. + * + * @return builder + * + */ + public Builder notificationLists(List notificationLists) { + return notificationLists(Output.of(notificationLists)); + } + + /** + * @param notificationLists A list of id's for notification lists whose notifiers will be triggered by the alert. + * + * @return builder + * + */ + public Builder notificationLists(String... notificationLists) { + return notificationLists(List.of(notificationLists)); + } + + /** + * @param recordIds A list of record id's this alert applies to. + * + * @return builder + * + */ + public Builder recordIds(@Nullable Output> recordIds) { + $.recordIds = recordIds; + return this; + } + + /** + * @param recordIds A list of record id's this alert applies to. + * + * @return builder + * + */ + public Builder recordIds(List recordIds) { + return recordIds(Output.of(recordIds)); + } + + /** + * @param recordIds A list of record id's this alert applies to. + * + * @return builder + * + */ + public Builder recordIds(String... recordIds) { + return recordIds(List.of(recordIds)); + } + + /** + * @param subtype The type of the alert. + * + * @return builder + * + */ + public Builder subtype(@Nullable Output subtype) { + $.subtype = subtype; + return this; + } + + /** + * @param subtype The type of the alert. + * + * @return builder + * + */ + public Builder subtype(String subtype) { + return subtype(Output.of(subtype)); + } + + /** + * @param type The type of the alert. + * + * @return builder + * + */ + public Builder type(@Nullable Output type) { + $.type = type; + return this; + } + + /** + * @param type The type of the alert. + * + * @return builder + * + */ + public Builder type(String type) { + return type(Output.of(type)); + } + + /** + * @param updatedAt (Read Only) The Unix timestamp representing when the alert configuration was last modified. + * + * @return builder + * + */ + public Builder updatedAt(@Nullable Output updatedAt) { + $.updatedAt = updatedAt; + return this; + } + + /** + * @param updatedAt (Read Only) The Unix timestamp representing when the alert configuration was last modified. + * + * @return builder + * + */ + public Builder updatedAt(Integer updatedAt) { + return updatedAt(Output.of(updatedAt)); + } + + /** + * @param updatedBy (Read Only) The user or apikey that last modified this alert. + * + * @return builder + * + */ + public Builder updatedBy(@Nullable Output updatedBy) { + $.updatedBy = updatedBy; + return this; + } + + /** + * @param updatedBy (Read Only) The user or apikey that last modified this alert. + * + * @return builder + * + */ + public Builder updatedBy(String updatedBy) { + return updatedBy(Output.of(updatedBy)); + } + + /** + * @param zoneNames A list of zones this alert applies to. + * + * @return builder + * + */ + public Builder zoneNames(@Nullable Output> zoneNames) { + $.zoneNames = zoneNames; + return this; + } + + /** + * @param zoneNames A list of zones this alert applies to. + * + * @return builder + * + */ + public Builder zoneNames(List zoneNames) { + return zoneNames(Output.of(zoneNames)); + } + + /** + * @param zoneNames A list of zones this alert applies to. + * + * @return builder + * + */ + public Builder zoneNames(String... zoneNames) { + return zoneNames(List.of(zoneNames)); + } + + public AlertState build() { + return $; + } + } + +} diff --git a/sdk/nodejs/alert.ts b/sdk/nodejs/alert.ts new file mode 100644 index 0000000..6dc5013 --- /dev/null +++ b/sdk/nodejs/alert.ts @@ -0,0 +1,226 @@ +// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +import * as pulumi from "@pulumi/pulumi"; +import * as utilities from "./utilities"; + +/** + * Provides a NS1 Alert resource. This can be used to create, modify, and delete alerts. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as ns1 from "@pulumi/ns1"; + * + * const example = new ns1.Alert("example", { + * name: "Example Alert", + * type: "zone", + * subtype: "transfer_failed", + * notificationLists: [], + * zoneNames: [], + * recordIds: [], + * }); + * ``` + * + * ## NS1 Documentation + * + * [Alerts Api Doc](https://ns1.com/api#alerts) + * + * ## Import + * + * ```sh + * $ pulumi import ns1:index/alert:Alert ` + * ``` + */ +export class Alert extends pulumi.CustomResource { + /** + * Get an existing Alert resource's state with the given name, ID, and optional extra + * properties used to qualify the lookup. + * + * @param name The _unique_ name of the resulting resource. + * @param id The _unique_ provider ID of the resource to lookup. + * @param state Any extra arguments used during the lookup. + * @param opts Optional settings to control the behavior of the CustomResource. + */ + public static get(name: string, id: pulumi.Input, state?: AlertState, opts?: pulumi.CustomResourceOptions): Alert { + return new Alert(name, state, { ...opts, id: id }); + } + + /** @internal */ + public static readonly __pulumiType = 'ns1:index/alert:Alert'; + + /** + * Returns true if the given object is an instance of Alert. This is designed to work even + * when multiple copies of the Pulumi SDK have been loaded into the same process. + */ + public static isInstance(obj: any): obj is Alert { + if (obj === undefined || obj === null) { + return false; + } + return obj['__pulumiType'] === Alert.__pulumiType; + } + + /** + * (Read Only) The Unix timestamp representing when the alert configuration was created. + */ + public /*out*/ readonly createdAt!: pulumi.Output; + /** + * (Read Only) The user or apikey that created this alert. + */ + public /*out*/ readonly createdBy!: pulumi.Output; + /** + * The free-form display name for the alert. + */ + public readonly name!: pulumi.Output; + /** + * A list of id's for notification lists whose notifiers will be triggered by the alert. + */ + public readonly notificationLists!: pulumi.Output; + /** + * A list of record id's this alert applies to. + */ + public readonly recordIds!: pulumi.Output; + /** + * The type of the alert. + */ + public readonly subtype!: pulumi.Output; + /** + * The type of the alert. + */ + public readonly type!: pulumi.Output; + /** + * (Read Only) The Unix timestamp representing when the alert configuration was last modified. + */ + public /*out*/ readonly updatedAt!: pulumi.Output; + /** + * (Read Only) The user or apikey that last modified this alert. + */ + public /*out*/ readonly updatedBy!: pulumi.Output; + /** + * A list of zones this alert applies to. + */ + public readonly zoneNames!: pulumi.Output; + + /** + * Create a Alert resource with the given unique name, arguments, and options. + * + * @param name The _unique_ name of the resource. + * @param args The arguments to use to populate this resource's properties. + * @param opts A bag of options that control this resource's behavior. + */ + constructor(name: string, args: AlertArgs, opts?: pulumi.CustomResourceOptions) + constructor(name: string, argsOrState?: AlertArgs | AlertState, opts?: pulumi.CustomResourceOptions) { + let resourceInputs: pulumi.Inputs = {}; + opts = opts || {}; + if (opts.id) { + const state = argsOrState as AlertState | undefined; + resourceInputs["createdAt"] = state ? state.createdAt : undefined; + resourceInputs["createdBy"] = state ? state.createdBy : undefined; + resourceInputs["name"] = state ? state.name : undefined; + resourceInputs["notificationLists"] = state ? state.notificationLists : undefined; + resourceInputs["recordIds"] = state ? state.recordIds : undefined; + resourceInputs["subtype"] = state ? state.subtype : undefined; + resourceInputs["type"] = state ? state.type : undefined; + resourceInputs["updatedAt"] = state ? state.updatedAt : undefined; + resourceInputs["updatedBy"] = state ? state.updatedBy : undefined; + resourceInputs["zoneNames"] = state ? state.zoneNames : undefined; + } else { + const args = argsOrState as AlertArgs | undefined; + if ((!args || args.subtype === undefined) && !opts.urn) { + throw new Error("Missing required property 'subtype'"); + } + if ((!args || args.type === undefined) && !opts.urn) { + throw new Error("Missing required property 'type'"); + } + resourceInputs["name"] = args ? args.name : undefined; + resourceInputs["notificationLists"] = args ? args.notificationLists : undefined; + resourceInputs["recordIds"] = args ? args.recordIds : undefined; + resourceInputs["subtype"] = args ? args.subtype : undefined; + resourceInputs["type"] = args ? args.type : undefined; + resourceInputs["zoneNames"] = args ? args.zoneNames : undefined; + resourceInputs["createdAt"] = undefined /*out*/; + resourceInputs["createdBy"] = undefined /*out*/; + resourceInputs["updatedAt"] = undefined /*out*/; + resourceInputs["updatedBy"] = undefined /*out*/; + } + opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); + super(Alert.__pulumiType, name, resourceInputs, opts); + } +} + +/** + * Input properties used for looking up and filtering Alert resources. + */ +export interface AlertState { + /** + * (Read Only) The Unix timestamp representing when the alert configuration was created. + */ + createdAt?: pulumi.Input; + /** + * (Read Only) The user or apikey that created this alert. + */ + createdBy?: pulumi.Input; + /** + * The free-form display name for the alert. + */ + name?: pulumi.Input; + /** + * A list of id's for notification lists whose notifiers will be triggered by the alert. + */ + notificationLists?: pulumi.Input[]>; + /** + * A list of record id's this alert applies to. + */ + recordIds?: pulumi.Input[]>; + /** + * The type of the alert. + */ + subtype?: pulumi.Input; + /** + * The type of the alert. + */ + type?: pulumi.Input; + /** + * (Read Only) The Unix timestamp representing when the alert configuration was last modified. + */ + updatedAt?: pulumi.Input; + /** + * (Read Only) The user or apikey that last modified this alert. + */ + updatedBy?: pulumi.Input; + /** + * A list of zones this alert applies to. + */ + zoneNames?: pulumi.Input[]>; +} + +/** + * The set of arguments for constructing a Alert resource. + */ +export interface AlertArgs { + /** + * The free-form display name for the alert. + */ + name?: pulumi.Input; + /** + * A list of id's for notification lists whose notifiers will be triggered by the alert. + */ + notificationLists?: pulumi.Input[]>; + /** + * A list of record id's this alert applies to. + */ + recordIds?: pulumi.Input[]>; + /** + * The type of the alert. + */ + subtype: pulumi.Input; + /** + * The type of the alert. + */ + type: pulumi.Input; + /** + * A list of zones this alert applies to. + */ + zoneNames?: pulumi.Input[]>; +} diff --git a/sdk/nodejs/index.ts b/sdk/nodejs/index.ts index 0956338..992afe0 100644 --- a/sdk/nodejs/index.ts +++ b/sdk/nodejs/index.ts @@ -10,6 +10,11 @@ export type AccountWhitelist = import("./accountWhitelist").AccountWhitelist; export const AccountWhitelist: typeof import("./accountWhitelist").AccountWhitelist = null as any; utilities.lazyLoad(exports, ["AccountWhitelist"], () => require("./accountWhitelist")); +export { AlertArgs, AlertState } from "./alert"; +export type Alert = import("./alert").Alert; +export const Alert: typeof import("./alert").Alert = null as any; +utilities.lazyLoad(exports, ["Alert"], () => require("./alert")); + export { APIKeyArgs, APIKeyState } from "./apikey"; export type APIKey = import("./apikey").APIKey; export const APIKey: typeof import("./apikey").APIKey = null as any; @@ -138,6 +143,8 @@ const _module = { return new APIKey(name, undefined, { urn }) case "ns1:index/accountWhitelist:AccountWhitelist": return new AccountWhitelist(name, undefined, { urn }) + case "ns1:index/alert:Alert": + return new Alert(name, undefined, { urn }) case "ns1:index/application:Application": return new Application(name, undefined, { urn }) case "ns1:index/dataFeed:DataFeed": @@ -175,6 +182,7 @@ const _module = { }; pulumi.runtime.registerResourceModule("ns1", "index/aPIKey", _module) pulumi.runtime.registerResourceModule("ns1", "index/accountWhitelist", _module) +pulumi.runtime.registerResourceModule("ns1", "index/alert", _module) pulumi.runtime.registerResourceModule("ns1", "index/application", _module) pulumi.runtime.registerResourceModule("ns1", "index/dataFeed", _module) pulumi.runtime.registerResourceModule("ns1", "index/dataSource", _module) diff --git a/sdk/nodejs/tsconfig.json b/sdk/nodejs/tsconfig.json index 111b23b..d5205a0 100644 --- a/sdk/nodejs/tsconfig.json +++ b/sdk/nodejs/tsconfig.json @@ -14,6 +14,7 @@ }, "files": [ "accountWhitelist.ts", + "alert.ts", "apikey.ts", "application.ts", "config/index.ts", diff --git a/sdk/python/pulumi_ns1/__init__.py b/sdk/python/pulumi_ns1/__init__.py index 157620d..53f7fbb 100644 --- a/sdk/python/pulumi_ns1/__init__.py +++ b/sdk/python/pulumi_ns1/__init__.py @@ -6,6 +6,7 @@ import typing # Export this package's modules as members: from .account_whitelist import * +from .alert import * from .api_key import * from .application import * from .data_feed import * @@ -57,6 +58,14 @@ "ns1:index/accountWhitelist:AccountWhitelist": "AccountWhitelist" } }, + { + "pkg": "ns1", + "mod": "index/alert", + "fqn": "pulumi_ns1", + "classes": { + "ns1:index/alert:Alert": "Alert" + } + }, { "pkg": "ns1", "mod": "index/application", diff --git a/sdk/python/pulumi_ns1/alert.py b/sdk/python/pulumi_ns1/alert.py new file mode 100644 index 0000000..58e0280 --- /dev/null +++ b/sdk/python/pulumi_ns1/alert.py @@ -0,0 +1,549 @@ +# coding=utf-8 +# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** +# *** Do not edit by hand unless you're certain you know what you are doing! *** + +import copy +import warnings +import sys +import pulumi +import pulumi.runtime +from typing import Any, Mapping, Optional, Sequence, Union, overload +if sys.version_info >= (3, 11): + from typing import NotRequired, TypedDict, TypeAlias +else: + from typing_extensions import NotRequired, TypedDict, TypeAlias +from . import _utilities + +__all__ = ['AlertArgs', 'Alert'] + +@pulumi.input_type +class AlertArgs: + def __init__(__self__, *, + subtype: pulumi.Input[str], + type: pulumi.Input[str], + name: Optional[pulumi.Input[str]] = None, + notification_lists: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + record_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + zone_names: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None): + """ + The set of arguments for constructing a Alert resource. + :param pulumi.Input[str] subtype: The type of the alert. + :param pulumi.Input[str] type: The type of the alert. + :param pulumi.Input[str] name: The free-form display name for the alert. + :param pulumi.Input[Sequence[pulumi.Input[str]]] notification_lists: A list of id's for notification lists whose notifiers will be triggered by the alert. + :param pulumi.Input[Sequence[pulumi.Input[str]]] record_ids: A list of record id's this alert applies to. + :param pulumi.Input[Sequence[pulumi.Input[str]]] zone_names: A list of zones this alert applies to. + """ + pulumi.set(__self__, "subtype", subtype) + pulumi.set(__self__, "type", type) + if name is not None: + pulumi.set(__self__, "name", name) + if notification_lists is not None: + pulumi.set(__self__, "notification_lists", notification_lists) + if record_ids is not None: + pulumi.set(__self__, "record_ids", record_ids) + if zone_names is not None: + pulumi.set(__self__, "zone_names", zone_names) + + @property + @pulumi.getter + def subtype(self) -> pulumi.Input[str]: + """ + The type of the alert. + """ + return pulumi.get(self, "subtype") + + @subtype.setter + def subtype(self, value: pulumi.Input[str]): + pulumi.set(self, "subtype", value) + + @property + @pulumi.getter + def type(self) -> pulumi.Input[str]: + """ + The type of the alert. + """ + return pulumi.get(self, "type") + + @type.setter + def type(self, value: pulumi.Input[str]): + pulumi.set(self, "type", value) + + @property + @pulumi.getter + def name(self) -> Optional[pulumi.Input[str]]: + """ + The free-form display name for the alert. + """ + return pulumi.get(self, "name") + + @name.setter + def name(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "name", value) + + @property + @pulumi.getter(name="notificationLists") + def notification_lists(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]: + """ + A list of id's for notification lists whose notifiers will be triggered by the alert. + """ + return pulumi.get(self, "notification_lists") + + @notification_lists.setter + def notification_lists(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]): + pulumi.set(self, "notification_lists", value) + + @property + @pulumi.getter(name="recordIds") + def record_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]: + """ + A list of record id's this alert applies to. + """ + return pulumi.get(self, "record_ids") + + @record_ids.setter + def record_ids(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]): + pulumi.set(self, "record_ids", value) + + @property + @pulumi.getter(name="zoneNames") + def zone_names(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]: + """ + A list of zones this alert applies to. + """ + return pulumi.get(self, "zone_names") + + @zone_names.setter + def zone_names(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]): + pulumi.set(self, "zone_names", value) + + +@pulumi.input_type +class _AlertState: + def __init__(__self__, *, + created_at: Optional[pulumi.Input[int]] = None, + created_by: Optional[pulumi.Input[str]] = None, + name: Optional[pulumi.Input[str]] = None, + notification_lists: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + record_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + subtype: Optional[pulumi.Input[str]] = None, + type: Optional[pulumi.Input[str]] = None, + updated_at: Optional[pulumi.Input[int]] = None, + updated_by: Optional[pulumi.Input[str]] = None, + zone_names: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None): + """ + Input properties used for looking up and filtering Alert resources. + :param pulumi.Input[int] created_at: (Read Only) The Unix timestamp representing when the alert configuration was created. + :param pulumi.Input[str] created_by: (Read Only) The user or apikey that created this alert. + :param pulumi.Input[str] name: The free-form display name for the alert. + :param pulumi.Input[Sequence[pulumi.Input[str]]] notification_lists: A list of id's for notification lists whose notifiers will be triggered by the alert. + :param pulumi.Input[Sequence[pulumi.Input[str]]] record_ids: A list of record id's this alert applies to. + :param pulumi.Input[str] subtype: The type of the alert. + :param pulumi.Input[str] type: The type of the alert. + :param pulumi.Input[int] updated_at: (Read Only) The Unix timestamp representing when the alert configuration was last modified. + :param pulumi.Input[str] updated_by: (Read Only) The user or apikey that last modified this alert. + :param pulumi.Input[Sequence[pulumi.Input[str]]] zone_names: A list of zones this alert applies to. + """ + if created_at is not None: + pulumi.set(__self__, "created_at", created_at) + if created_by is not None: + pulumi.set(__self__, "created_by", created_by) + if name is not None: + pulumi.set(__self__, "name", name) + if notification_lists is not None: + pulumi.set(__self__, "notification_lists", notification_lists) + if record_ids is not None: + pulumi.set(__self__, "record_ids", record_ids) + if subtype is not None: + pulumi.set(__self__, "subtype", subtype) + if type is not None: + pulumi.set(__self__, "type", type) + if updated_at is not None: + pulumi.set(__self__, "updated_at", updated_at) + if updated_by is not None: + pulumi.set(__self__, "updated_by", updated_by) + if zone_names is not None: + pulumi.set(__self__, "zone_names", zone_names) + + @property + @pulumi.getter(name="createdAt") + def created_at(self) -> Optional[pulumi.Input[int]]: + """ + (Read Only) The Unix timestamp representing when the alert configuration was created. + """ + return pulumi.get(self, "created_at") + + @created_at.setter + def created_at(self, value: Optional[pulumi.Input[int]]): + pulumi.set(self, "created_at", value) + + @property + @pulumi.getter(name="createdBy") + def created_by(self) -> Optional[pulumi.Input[str]]: + """ + (Read Only) The user or apikey that created this alert. + """ + return pulumi.get(self, "created_by") + + @created_by.setter + def created_by(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "created_by", value) + + @property + @pulumi.getter + def name(self) -> Optional[pulumi.Input[str]]: + """ + The free-form display name for the alert. + """ + return pulumi.get(self, "name") + + @name.setter + def name(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "name", value) + + @property + @pulumi.getter(name="notificationLists") + def notification_lists(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]: + """ + A list of id's for notification lists whose notifiers will be triggered by the alert. + """ + return pulumi.get(self, "notification_lists") + + @notification_lists.setter + def notification_lists(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]): + pulumi.set(self, "notification_lists", value) + + @property + @pulumi.getter(name="recordIds") + def record_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]: + """ + A list of record id's this alert applies to. + """ + return pulumi.get(self, "record_ids") + + @record_ids.setter + def record_ids(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]): + pulumi.set(self, "record_ids", value) + + @property + @pulumi.getter + def subtype(self) -> Optional[pulumi.Input[str]]: + """ + The type of the alert. + """ + return pulumi.get(self, "subtype") + + @subtype.setter + def subtype(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "subtype", value) + + @property + @pulumi.getter + def type(self) -> Optional[pulumi.Input[str]]: + """ + The type of the alert. + """ + return pulumi.get(self, "type") + + @type.setter + def type(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "type", value) + + @property + @pulumi.getter(name="updatedAt") + def updated_at(self) -> Optional[pulumi.Input[int]]: + """ + (Read Only) The Unix timestamp representing when the alert configuration was last modified. + """ + return pulumi.get(self, "updated_at") + + @updated_at.setter + def updated_at(self, value: Optional[pulumi.Input[int]]): + pulumi.set(self, "updated_at", value) + + @property + @pulumi.getter(name="updatedBy") + def updated_by(self) -> Optional[pulumi.Input[str]]: + """ + (Read Only) The user or apikey that last modified this alert. + """ + return pulumi.get(self, "updated_by") + + @updated_by.setter + def updated_by(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "updated_by", value) + + @property + @pulumi.getter(name="zoneNames") + def zone_names(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]: + """ + A list of zones this alert applies to. + """ + return pulumi.get(self, "zone_names") + + @zone_names.setter + def zone_names(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]): + pulumi.set(self, "zone_names", value) + + +class Alert(pulumi.CustomResource): + @overload + def __init__(__self__, + resource_name: str, + opts: Optional[pulumi.ResourceOptions] = None, + name: Optional[pulumi.Input[str]] = None, + notification_lists: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + record_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + subtype: Optional[pulumi.Input[str]] = None, + type: Optional[pulumi.Input[str]] = None, + zone_names: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + __props__=None): + """ + Provides a NS1 Alert resource. This can be used to create, modify, and delete alerts. + + ## Example Usage + + ```python + import pulumi + import pulumi_ns1 as ns1 + + example = ns1.Alert("example", + name="Example Alert", + type="zone", + subtype="transfer_failed", + notification_lists=[], + zone_names=[], + record_ids=[]) + ``` + + ## NS1 Documentation + + [Alerts Api Doc](https://ns1.com/api#alerts) + + ## Import + + ```sh + $ pulumi import ns1:index/alert:Alert ` + ``` + + :param str resource_name: The name of the resource. + :param pulumi.ResourceOptions opts: Options for the resource. + :param pulumi.Input[str] name: The free-form display name for the alert. + :param pulumi.Input[Sequence[pulumi.Input[str]]] notification_lists: A list of id's for notification lists whose notifiers will be triggered by the alert. + :param pulumi.Input[Sequence[pulumi.Input[str]]] record_ids: A list of record id's this alert applies to. + :param pulumi.Input[str] subtype: The type of the alert. + :param pulumi.Input[str] type: The type of the alert. + :param pulumi.Input[Sequence[pulumi.Input[str]]] zone_names: A list of zones this alert applies to. + """ + ... + @overload + def __init__(__self__, + resource_name: str, + args: AlertArgs, + opts: Optional[pulumi.ResourceOptions] = None): + """ + Provides a NS1 Alert resource. This can be used to create, modify, and delete alerts. + + ## Example Usage + + ```python + import pulumi + import pulumi_ns1 as ns1 + + example = ns1.Alert("example", + name="Example Alert", + type="zone", + subtype="transfer_failed", + notification_lists=[], + zone_names=[], + record_ids=[]) + ``` + + ## NS1 Documentation + + [Alerts Api Doc](https://ns1.com/api#alerts) + + ## Import + + ```sh + $ pulumi import ns1:index/alert:Alert ` + ``` + + :param str resource_name: The name of the resource. + :param AlertArgs args: The arguments to use to populate this resource's properties. + :param pulumi.ResourceOptions opts: Options for the resource. + """ + ... + def __init__(__self__, resource_name: str, *args, **kwargs): + resource_args, opts = _utilities.get_resource_args_opts(AlertArgs, pulumi.ResourceOptions, *args, **kwargs) + if resource_args is not None: + __self__._internal_init(resource_name, opts, **resource_args.__dict__) + else: + __self__._internal_init(resource_name, *args, **kwargs) + + def _internal_init(__self__, + resource_name: str, + opts: Optional[pulumi.ResourceOptions] = None, + name: Optional[pulumi.Input[str]] = None, + notification_lists: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + record_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + subtype: Optional[pulumi.Input[str]] = None, + type: Optional[pulumi.Input[str]] = None, + zone_names: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + __props__=None): + opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts) + if not isinstance(opts, pulumi.ResourceOptions): + raise TypeError('Expected resource options to be a ResourceOptions instance') + if opts.id is None: + if __props__ is not None: + raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource') + __props__ = AlertArgs.__new__(AlertArgs) + + __props__.__dict__["name"] = name + __props__.__dict__["notification_lists"] = notification_lists + __props__.__dict__["record_ids"] = record_ids + if subtype is None and not opts.urn: + raise TypeError("Missing required property 'subtype'") + __props__.__dict__["subtype"] = subtype + if type is None and not opts.urn: + raise TypeError("Missing required property 'type'") + __props__.__dict__["type"] = type + __props__.__dict__["zone_names"] = zone_names + __props__.__dict__["created_at"] = None + __props__.__dict__["created_by"] = None + __props__.__dict__["updated_at"] = None + __props__.__dict__["updated_by"] = None + super(Alert, __self__).__init__( + 'ns1:index/alert:Alert', + resource_name, + __props__, + opts) + + @staticmethod + def get(resource_name: str, + id: pulumi.Input[str], + opts: Optional[pulumi.ResourceOptions] = None, + created_at: Optional[pulumi.Input[int]] = None, + created_by: Optional[pulumi.Input[str]] = None, + name: Optional[pulumi.Input[str]] = None, + notification_lists: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + record_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + subtype: Optional[pulumi.Input[str]] = None, + type: Optional[pulumi.Input[str]] = None, + updated_at: Optional[pulumi.Input[int]] = None, + updated_by: Optional[pulumi.Input[str]] = None, + zone_names: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None) -> 'Alert': + """ + Get an existing Alert resource's state with the given name, id, and optional extra + properties used to qualify the lookup. + + :param str resource_name: The unique name of the resulting resource. + :param pulumi.Input[str] id: The unique provider ID of the resource to lookup. + :param pulumi.ResourceOptions opts: Options for the resource. + :param pulumi.Input[int] created_at: (Read Only) The Unix timestamp representing when the alert configuration was created. + :param pulumi.Input[str] created_by: (Read Only) The user or apikey that created this alert. + :param pulumi.Input[str] name: The free-form display name for the alert. + :param pulumi.Input[Sequence[pulumi.Input[str]]] notification_lists: A list of id's for notification lists whose notifiers will be triggered by the alert. + :param pulumi.Input[Sequence[pulumi.Input[str]]] record_ids: A list of record id's this alert applies to. + :param pulumi.Input[str] subtype: The type of the alert. + :param pulumi.Input[str] type: The type of the alert. + :param pulumi.Input[int] updated_at: (Read Only) The Unix timestamp representing when the alert configuration was last modified. + :param pulumi.Input[str] updated_by: (Read Only) The user or apikey that last modified this alert. + :param pulumi.Input[Sequence[pulumi.Input[str]]] zone_names: A list of zones this alert applies to. + """ + opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) + + __props__ = _AlertState.__new__(_AlertState) + + __props__.__dict__["created_at"] = created_at + __props__.__dict__["created_by"] = created_by + __props__.__dict__["name"] = name + __props__.__dict__["notification_lists"] = notification_lists + __props__.__dict__["record_ids"] = record_ids + __props__.__dict__["subtype"] = subtype + __props__.__dict__["type"] = type + __props__.__dict__["updated_at"] = updated_at + __props__.__dict__["updated_by"] = updated_by + __props__.__dict__["zone_names"] = zone_names + return Alert(resource_name, opts=opts, __props__=__props__) + + @property + @pulumi.getter(name="createdAt") + def created_at(self) -> pulumi.Output[int]: + """ + (Read Only) The Unix timestamp representing when the alert configuration was created. + """ + return pulumi.get(self, "created_at") + + @property + @pulumi.getter(name="createdBy") + def created_by(self) -> pulumi.Output[str]: + """ + (Read Only) The user or apikey that created this alert. + """ + return pulumi.get(self, "created_by") + + @property + @pulumi.getter + def name(self) -> pulumi.Output[str]: + """ + The free-form display name for the alert. + """ + return pulumi.get(self, "name") + + @property + @pulumi.getter(name="notificationLists") + def notification_lists(self) -> pulumi.Output[Optional[Sequence[str]]]: + """ + A list of id's for notification lists whose notifiers will be triggered by the alert. + """ + return pulumi.get(self, "notification_lists") + + @property + @pulumi.getter(name="recordIds") + def record_ids(self) -> pulumi.Output[Optional[Sequence[str]]]: + """ + A list of record id's this alert applies to. + """ + return pulumi.get(self, "record_ids") + + @property + @pulumi.getter + def subtype(self) -> pulumi.Output[str]: + """ + The type of the alert. + """ + return pulumi.get(self, "subtype") + + @property + @pulumi.getter + def type(self) -> pulumi.Output[str]: + """ + The type of the alert. + """ + return pulumi.get(self, "type") + + @property + @pulumi.getter(name="updatedAt") + def updated_at(self) -> pulumi.Output[int]: + """ + (Read Only) The Unix timestamp representing when the alert configuration was last modified. + """ + return pulumi.get(self, "updated_at") + + @property + @pulumi.getter(name="updatedBy") + def updated_by(self) -> pulumi.Output[str]: + """ + (Read Only) The user or apikey that last modified this alert. + """ + return pulumi.get(self, "updated_by") + + @property + @pulumi.getter(name="zoneNames") + def zone_names(self) -> pulumi.Output[Optional[Sequence[str]]]: + """ + A list of zones this alert applies to. + """ + return pulumi.get(self, "zone_names") +