From 4a50819a06142139232892958b36fbea34dcbd28 Mon Sep 17 00:00:00 2001 From: Ian Wahbe Date: Mon, 24 Jun 2024 10:44:55 -0700 Subject: [PATCH] Remove cache and retry This introduces a codegen regression, but is in-general worth it to avoid blocking the release. I will file a follow up issue in pulumi/pulumi. --- provider/cmd/pulumi-resource-ns1/schema.json | 2 +- sdk/go/ns1/record.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/provider/cmd/pulumi-resource-ns1/schema.json b/provider/cmd/pulumi-resource-ns1/schema.json index 5742bab..ae71ee9 100644 --- a/provider/cmd/pulumi-resource-ns1/schema.json +++ b/provider/cmd/pulumi-resource-ns1/schema.json @@ -2313,7 +2313,7 @@ } }, "ns1:index/record:Record": { - "description": "Provides a NS1 Record resource. This can be used to create, modify, and delete records.\n\n## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as external from \"@pulumi/external\";\nimport * as ns1 from \"@pulumi/ns1\";\nimport * as std from \"@pulumi/std\";\n\nconst example = new ns1.Zone(\"example\", {zone: \"terraform.example.io\"});\nconst ns1 = new ns1.DataSource(\"ns1\", {\n name: \"ns1_source\",\n sourcetype: \"nsone_v1\",\n});\nconst foo = new ns1.DataFeed(\"foo\", {\n name: \"foo_feed\",\n sourceId: ns1.id,\n config: {\n label: \"foo\",\n },\n});\nconst bar = new ns1.DataFeed(\"bar\", {\n name: \"bar_feed\",\n sourceId: ns1.id,\n config: {\n label: \"bar\",\n },\n});\nconst www = new ns1.Record(\"www\", {\n zone: tld.zone,\n domain: `www.${tld.zone}`,\n type: \"CNAME\",\n ttl: 60,\n meta: {\n up: true,\n },\n regions: [\n {\n name: \"east\",\n meta: {\n georegion: \"US-EAST\",\n },\n },\n {\n name: \"usa\",\n meta: {\n country: \"US\",\n },\n },\n ],\n answers: [\n {\n answer: `sub1.${tld.zone}`,\n region: \"east\",\n meta: {\n up: pulumi.interpolate`{\"feed\":\"${foo.id}\"}`,\n },\n },\n {\n answer: `sub2.${tld.zone}`,\n meta: {\n up: pulumi.interpolate`{\"feed\":\"${bar.id}\"}`,\n connections: 3,\n },\n },\n {\n answer: `sub3.${tld.zone}`,\n meta: {\n pulsar: JSON.stringify([{\n job_id: \"abcdef\",\n bias: \"*0.55\",\n a5m_cutoff: 0.9,\n }]),\n subdivisions: JSON.stringify({\n BR: [\n \"SP\",\n \"SC\",\n ],\n DZ: [\n \"01\",\n \"02\",\n \"03\",\n ],\n }),\n },\n },\n ],\n filters: [{\n filter: \"select_first_n\",\n config: {\n N: 1,\n },\n }],\n});\n// Some other non-NS1 provider that returns a zone with a trailing dot and a domain with a leading dot.\nconst baz = new external.index.Source(\"baz\", {\n zone: \"terraform.example.io.\",\n domain: \".www.terraform.example.io\",\n});\n// Basic record showing how to clean a zone or domain field that comes from\n// another non-NS1 resource. DNS names often end in '.' characters to signify\n// the root of the DNS tree, but the NS1 provider does not support this.\n//\n// In other cases, a domain or zone may be passed in with a preceding dot ('.')\n// character which would likewise lead the system to fail.\nconst external = new ns1.Record(\"external\", {\n zone: std.replace({\n text: zone,\n search: \"/(^\\\\.)|(\\\\.$)/\",\n replace: \"\",\n }).then(invoke =\u003e invoke.result),\n domain: std.replace({\n text: domain,\n search: \"/(^\\\\.)|(\\\\.$)/\",\n replace: \"\",\n }).then(invoke =\u003e invoke.result),\n type: \"CNAME\",\n});\n```\n```python\nimport pulumi\nimport json\nimport pulumi_external as external\nimport pulumi_ns1 as ns1\nimport pulumi_std as std\n\nexample = ns1.Zone(\"example\", zone=\"terraform.example.io\")\nns1 = ns1.DataSource(\"ns1\",\n name=\"ns1_source\",\n sourcetype=\"nsone_v1\")\nfoo = ns1.DataFeed(\"foo\",\n name=\"foo_feed\",\n source_id=ns1.id,\n config={\n \"label\": \"foo\",\n })\nbar = ns1.DataFeed(\"bar\",\n name=\"bar_feed\",\n source_id=ns1.id,\n config={\n \"label\": \"bar\",\n })\nwww = ns1.Record(\"www\",\n zone=tld[\"zone\"],\n domain=f\"www.{tld['zone']}\",\n type=\"CNAME\",\n ttl=60,\n meta={\n \"up\": True,\n },\n regions=[\n ns1.RecordRegionArgs(\n name=\"east\",\n meta={\n \"georegion\": \"US-EAST\",\n },\n ),\n ns1.RecordRegionArgs(\n name=\"usa\",\n meta={\n \"country\": \"US\",\n },\n ),\n ],\n answers=[\n ns1.RecordAnswerArgs(\n answer=f\"sub1.{tld['zone']}\",\n region=\"east\",\n meta={\n \"up\": foo.id.apply(lambda id: f\"{{\\\"feed\\\":\\\"{id}\\\"}}\"),\n },\n ),\n ns1.RecordAnswerArgs(\n answer=f\"sub2.{tld['zone']}\",\n meta={\n \"up\": bar.id.apply(lambda id: f\"{{\\\"feed\\\":\\\"{id}\\\"}}\"),\n \"connections\": 3,\n },\n ),\n ns1.RecordAnswerArgs(\n answer=f\"sub3.{tld['zone']}\",\n meta={\n \"pulsar\": json.dumps([{\n \"job_id\": \"abcdef\",\n \"bias\": \"*0.55\",\n \"a5m_cutoff\": 0.9,\n }]),\n \"subdivisions\": json.dumps({\n \"BR\": [\n \"SP\",\n \"SC\",\n ],\n \"DZ\": [\n \"01\",\n \"02\",\n \"03\",\n ],\n }),\n },\n ),\n ],\n filters=[ns1.RecordFilterArgs(\n filter=\"select_first_n\",\n config={\n \"N\": 1,\n },\n )])\n# Some other non-NS1 provider that returns a zone with a trailing dot and a domain with a leading dot.\nbaz = external.index.Source(\"baz\",\n zone=terraform.example.io.,\n domain=.www.terraform.example.io)\n# Basic record showing how to clean a zone or domain field that comes from\n# another non-NS1 resource. DNS names often end in '.' characters to signify\n# the root of the DNS tree, but the NS1 provider does not support this.\n#\n# In other cases, a domain or zone may be passed in with a preceding dot ('.')\n# character which would likewise lead the system to fail.\nexternal = ns1.Record(\"external\",\n zone=std.replace(text=zone,\n search=\"/(^\\\\.)|(\\\\.$)/\",\n replace=\"\").result,\n domain=std.replace(text=domain,\n search=\"/(^\\\\.)|(\\\\.$)/\",\n replace=\"\").result,\n type=\"CNAME\")\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Pulumi;\nusing External = Pulumi.External;\nusing Ns1 = Pulumi.Ns1;\nusing Std = Pulumi.Std;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Ns1.Zone(\"example\", new()\n {\n ZoneName = \"terraform.example.io\",\n });\n\n var ns1 = new Ns1.DataSource(\"ns1\", new()\n {\n Name = \"ns1_source\",\n Sourcetype = \"nsone_v1\",\n });\n\n var foo = new Ns1.DataFeed(\"foo\", new()\n {\n Name = \"foo_feed\",\n SourceId = ns1.Id,\n Config = \n {\n { \"label\", \"foo\" },\n },\n });\n\n var bar = new Ns1.DataFeed(\"bar\", new()\n {\n Name = \"bar_feed\",\n SourceId = ns1.Id,\n Config = \n {\n { \"label\", \"bar\" },\n },\n });\n\n var www = new Ns1.Record(\"www\", new()\n {\n Zone = tld.Zone,\n Domain = $\"www.{tld.Zone}\",\n Type = \"CNAME\",\n Ttl = 60,\n Meta = \n {\n { \"up\", true },\n },\n Regions = new[]\n {\n new Ns1.Inputs.RecordRegionArgs\n {\n Name = \"east\",\n Meta = \n {\n { \"georegion\", \"US-EAST\" },\n },\n },\n new Ns1.Inputs.RecordRegionArgs\n {\n Name = \"usa\",\n Meta = \n {\n { \"country\", \"US\" },\n },\n },\n },\n Answers = new[]\n {\n new Ns1.Inputs.RecordAnswerArgs\n {\n Answer = $\"sub1.{tld.Zone}\",\n Region = \"east\",\n Meta = \n {\n { \"up\", foo.Id.Apply(id =\u003e $\"{{\\\"feed\\\":\\\"{id}\\\"}}\") },\n },\n },\n new Ns1.Inputs.RecordAnswerArgs\n {\n Answer = $\"sub2.{tld.Zone}\",\n Meta = \n {\n { \"up\", bar.Id.Apply(id =\u003e $\"{{\\\"feed\\\":\\\"{id}\\\"}}\") },\n { \"connections\", 3 },\n },\n },\n new Ns1.Inputs.RecordAnswerArgs\n {\n Answer = $\"sub3.{tld.Zone}\",\n Meta = \n {\n { \"pulsar\", JsonSerializer.Serialize(new[]\n {\n new Dictionary\u003cstring, object?\u003e\n {\n [\"job_id\"] = \"abcdef\",\n [\"bias\"] = \"*0.55\",\n [\"a5m_cutoff\"] = 0.9,\n },\n }) },\n { \"subdivisions\", JsonSerializer.Serialize(new Dictionary\u003cstring, object?\u003e\n {\n [\"BR\"] = new[]\n {\n \"SP\",\n \"SC\",\n },\n [\"DZ\"] = new[]\n {\n \"01\",\n \"02\",\n \"03\",\n },\n }) },\n },\n },\n },\n Filters = new[]\n {\n new Ns1.Inputs.RecordFilterArgs\n {\n Filter = \"select_first_n\",\n Config = \n {\n { \"N\", 1 },\n },\n },\n },\n });\n\n // Some other non-NS1 provider that returns a zone with a trailing dot and a domain with a leading dot.\n var baz = new External.Index.Source(\"baz\", new()\n {\n Zone = \"terraform.example.io.\",\n Domain = \".www.terraform.example.io\",\n });\n\n // Basic record showing how to clean a zone or domain field that comes from\n // another non-NS1 resource. DNS names often end in '.' characters to signify\n // the root of the DNS tree, but the NS1 provider does not support this.\n //\n // In other cases, a domain or zone may be passed in with a preceding dot ('.')\n // character which would likewise lead the system to fail.\n var external = new Ns1.Record(\"external\", new()\n {\n Zone = Std.Replace.Invoke(new()\n {\n Text = zone,\n Search = \"/(^\\\\.)|(\\\\.$)/\",\n Replace = \"\",\n }).Apply(invoke =\u003e invoke.Result),\n Domain = Std.Replace.Invoke(new()\n {\n Text = domain,\n Search = \"/(^\\\\.)|(\\\\.$)/\",\n Replace = \"\",\n }).Apply(invoke =\u003e invoke.Result),\n Type = \"CNAME\",\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\n\t\"github.com/pulumi/pulumi-external/sdk/go/external\"\n\t\"github.com/pulumi/pulumi-ns1/sdk/v3/go/ns1\"\n\t\"github.com/pulumi/pulumi-std/sdk/go/std\"\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.NewZone(ctx, \"example\", \u0026ns1.ZoneArgs{\n\t\t\tZone: pulumi.String(\"terraform.example.io\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tns1, err := ns1.NewDataSource(ctx, \"ns1\", \u0026ns1.DataSourceArgs{\n\t\t\tName: pulumi.String(\"ns1_source\"),\n\t\t\tSourcetype: pulumi.String(\"nsone_v1\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfoo, err := ns1.NewDataFeed(ctx, \"foo\", \u0026ns1.DataFeedArgs{\n\t\t\tName: pulumi.String(\"foo_feed\"),\n\t\t\tSourceId: ns1.ID(),\n\t\t\tConfig: pulumi.Map{\n\t\t\t\t\"label\": pulumi.Any(\"foo\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbar, err := ns1.NewDataFeed(ctx, \"bar\", \u0026ns1.DataFeedArgs{\n\t\t\tName: pulumi.String(\"bar_feed\"),\n\t\t\tSourceId: ns1.ID(),\n\t\t\tConfig: pulumi.Map{\n\t\t\t\t\"label\": pulumi.Any(\"bar\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttmpJSON0, err := json.Marshal([]map[string]interface{}{\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"job_id\": \"abcdef\",\n\t\t\t\t\"bias\": \"*0.55\",\n\t\t\t\t\"a5m_cutoff\": 0.9,\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tjson0 := string(tmpJSON0)\n\t\ttmpJSON1, err := json.Marshal(map[string]interface{}{\n\t\t\t\"BR\": []string{\n\t\t\t\t\"SP\",\n\t\t\t\t\"SC\",\n\t\t\t},\n\t\t\t\"DZ\": []string{\n\t\t\t\t\"01\",\n\t\t\t\t\"02\",\n\t\t\t\t\"03\",\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tjson1 := string(tmpJSON1)\n\t\t_, err = ns1.NewRecord(ctx, \"www\", \u0026ns1.RecordArgs{\n\t\t\tZone: pulumi.Any(tld.Zone),\n\t\t\tDomain: pulumi.String(fmt.Sprintf(\"www.%v\", tld.Zone)),\n\t\t\tType: pulumi.String(\"CNAME\"),\n\t\t\tTtl: pulumi.Int(60),\n\t\t\tMeta: pulumi.Map{\n\t\t\t\t\"up\": pulumi.Any(true),\n\t\t\t},\n\t\t\tRegions: ns1.RecordRegionArray{\n\t\t\t\t\u0026ns1.RecordRegionArgs{\n\t\t\t\t\tName: pulumi.String(\"east\"),\n\t\t\t\t\tMeta: pulumi.Map{\n\t\t\t\t\t\t\"georegion\": pulumi.Any(\"US-EAST\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\u0026ns1.RecordRegionArgs{\n\t\t\t\t\tName: pulumi.String(\"usa\"),\n\t\t\t\t\tMeta: pulumi.Map{\n\t\t\t\t\t\t\"country\": pulumi.Any(\"US\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tAnswers: ns1.RecordAnswerArray{\n\t\t\t\t\u0026ns1.RecordAnswerArgs{\n\t\t\t\t\tAnswer: pulumi.String(fmt.Sprintf(\"sub1.%v\", tld.Zone)),\n\t\t\t\t\tRegion: pulumi.String(\"east\"),\n\t\t\t\t\tMeta: pulumi.Map{\n\t\t\t\t\t\t\"up\": foo.ID().ApplyT(func(id string) (string, error) {\n\t\t\t\t\t\t\treturn fmt.Sprintf(\"{\\\"feed\\\":\\\"%v\\\"}\", id), nil\n\t\t\t\t\t\t}).(pulumi.StringOutput),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\u0026ns1.RecordAnswerArgs{\n\t\t\t\t\tAnswer: pulumi.String(fmt.Sprintf(\"sub2.%v\", tld.Zone)),\n\t\t\t\t\tMeta: pulumi.Map{\n\t\t\t\t\t\t\"up\": bar.ID().ApplyT(func(id string) (string, error) {\n\t\t\t\t\t\t\treturn fmt.Sprintf(\"{\\\"feed\\\":\\\"%v\\\"}\", id), nil\n\t\t\t\t\t\t}).(pulumi.StringOutput),\n\t\t\t\t\t\t\"connections\": pulumi.Any(3),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\u0026ns1.RecordAnswerArgs{\n\t\t\t\t\tAnswer: pulumi.String(fmt.Sprintf(\"sub3.%v\", tld.Zone)),\n\t\t\t\t\tMeta: pulumi.Map{\n\t\t\t\t\t\t\"pulsar\": pulumi.String(json0),\n\t\t\t\t\t\t\"subdivisions\": pulumi.String(json1),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tFilters: ns1.RecordFilterArray{\n\t\t\t\t\u0026ns1.RecordFilterArgs{\n\t\t\t\t\tFilter: pulumi.String(\"select_first_n\"),\n\t\t\t\t\tConfig: pulumi.Map{\n\t\t\t\t\t\t\"N\": pulumi.Any(1),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Some other non-NS1 provider that returns a zone with a trailing dot and a domain with a leading dot.\n\t\t_, err = external.NewSource(ctx, \"baz\", \u0026external.SourceArgs{\n\t\t\tZone: \"terraform.example.io.\",\n\t\t\tDomain: \".www.terraform.example.io\",\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tinvokeReplace, err := std.Replace(ctx, \u0026std.ReplaceArgs{\n\t\t\tText: zone,\n\t\t\tSearch: \"/(^\\\\.)|(\\\\.$)/\",\n\t\t\tReplace: \"\",\n\t\t}, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tinvokeReplace1, err := std.Replace(ctx, \u0026std.ReplaceArgs{\n\t\t\tText: domain,\n\t\t\tSearch: \"/(^\\\\.)|(\\\\.$)/\",\n\t\t\tReplace: \"\",\n\t\t}, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Basic record showing how to clean a zone or domain field that comes from\n\t\t// another non-NS1 resource. DNS names often end in '.' characters to signify\n\t\t// the root of the DNS tree, but the NS1 provider does not support this.\n\t\t//\n\t\t// In other cases, a domain or zone may be passed in with a preceding dot ('.')\n\t\t// character which would likewise lead the system to fail.\n\t\t_, err = ns1.NewRecord(ctx, \"external\", \u0026ns1.RecordArgs{\n\t\t\tZone: invokeReplace.Result,\n\t\t\tDomain: invokeReplace1.Result,\n\t\t\tType: pulumi.String(\"CNAME\"),\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.Zone;\nimport com.pulumi.ns1.ZoneArgs;\nimport com.pulumi.ns1.DataSource;\nimport com.pulumi.ns1.DataSourceArgs;\nimport com.pulumi.ns1.DataFeed;\nimport com.pulumi.ns1.DataFeedArgs;\nimport com.pulumi.ns1.Record;\nimport com.pulumi.ns1.RecordArgs;\nimport com.pulumi.ns1.inputs.RecordRegionArgs;\nimport com.pulumi.ns1.inputs.RecordAnswerArgs;\nimport com.pulumi.ns1.inputs.RecordFilterArgs;\nimport com.pulumi.external.source;\nimport com.pulumi.external.SourceArgs;\nimport static com.pulumi.codegen.internal.Serialization.*;\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 Zone(\"example\", ZoneArgs.builder()\n .zone(\"terraform.example.io\")\n .build());\n\n var ns1 = new DataSource(\"ns1\", DataSourceArgs.builder()\n .name(\"ns1_source\")\n .sourcetype(\"nsone_v1\")\n .build());\n\n var foo = new DataFeed(\"foo\", DataFeedArgs.builder()\n .name(\"foo_feed\")\n .sourceId(ns1.id())\n .config(Map.of(\"label\", \"foo\"))\n .build());\n\n var bar = new DataFeed(\"bar\", DataFeedArgs.builder()\n .name(\"bar_feed\")\n .sourceId(ns1.id())\n .config(Map.of(\"label\", \"bar\"))\n .build());\n\n var www = new Record(\"www\", RecordArgs.builder()\n .zone(tld.zone())\n .domain(String.format(\"www.%s\", tld.zone()))\n .type(\"CNAME\")\n .ttl(60)\n .meta(Map.of(\"up\", true))\n .regions( \n RecordRegionArgs.builder()\n .name(\"east\")\n .meta(Map.of(\"georegion\", \"US-EAST\"))\n .build(),\n RecordRegionArgs.builder()\n .name(\"usa\")\n .meta(Map.of(\"country\", \"US\"))\n .build())\n .answers( \n RecordAnswerArgs.builder()\n .answer(String.format(\"sub1.%s\", tld.zone()))\n .region(\"east\")\n .meta(Map.of(\"up\", foo.id().applyValue(id -\u003e String.format(\"{{\\\"feed\\\":\\\"%s\\\"}}\", id))))\n .build(),\n RecordAnswerArgs.builder()\n .answer(String.format(\"sub2.%s\", tld.zone()))\n .meta(Map.ofEntries(\n Map.entry(\"up\", bar.id().applyValue(id -\u003e String.format(\"{{\\\"feed\\\":\\\"%s\\\"}}\", id))),\n Map.entry(\"connections\", 3)\n ))\n .build(),\n RecordAnswerArgs.builder()\n .answer(String.format(\"sub3.%s\", tld.zone()))\n .meta(Map.ofEntries(\n Map.entry(\"pulsar\", serializeJson(\n jsonArray(jsonObject(\n jsonProperty(\"job_id\", \"abcdef\"),\n jsonProperty(\"bias\", \"*0.55\"),\n jsonProperty(\"a5m_cutoff\", 0.9)\n )))),\n Map.entry(\"subdivisions\", serializeJson(\n jsonObject(\n jsonProperty(\"BR\", jsonArray(\n \"SP\", \n \"SC\"\n )),\n jsonProperty(\"DZ\", jsonArray(\n \"01\", \n \"02\", \n \"03\"\n ))\n )))\n ))\n .build())\n .filters(RecordFilterArgs.builder()\n .filter(\"select_first_n\")\n .config(Map.of(\"N\", 1))\n .build())\n .build());\n\n // Some other non-NS1 provider that returns a zone with a trailing dot and a domain with a leading dot.\n var baz = new Source(\"baz\", SourceArgs.builder()\n .zone(\"terraform.example.io.\")\n .domain(\".www.terraform.example.io\")\n .build());\n\n // Basic record showing how to clean a zone or domain field that comes from\n // another non-NS1 resource. DNS names often end in '.' characters to signify\n // the root of the DNS tree, but the NS1 provider does not support this.\n //\n // In other cases, a domain or zone may be passed in with a preceding dot ('.')\n // character which would likewise lead the system to fail.\n var external = new Record(\"external\", RecordArgs.builder()\n .zone(StdFunctions.replace(ReplaceArgs.builder()\n .text(zone)\n .search(\"/(^\\\\.)|(\\\\.$)/\")\n .replace(\"\")\n .build()).result())\n .domain(StdFunctions.replace(ReplaceArgs.builder()\n .text(domain)\n .search(\"/(^\\\\.)|(\\\\.$)/\")\n .replace(\"\")\n .build()).result())\n .type(\"CNAME\")\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: ns1:Zone\n properties:\n zone: terraform.example.io\n ns1:\n type: ns1:DataSource\n properties:\n name: ns1_source\n sourcetype: nsone_v1\n foo:\n type: ns1:DataFeed\n properties:\n name: foo_feed\n sourceId: ${ns1.id}\n config:\n label: foo\n bar:\n type: ns1:DataFeed\n properties:\n name: bar_feed\n sourceId: ${ns1.id}\n config:\n label: bar\n www:\n type: ns1:Record\n properties:\n zone: ${tld.zone}\n domain: www.${tld.zone}\n type: CNAME\n ttl: 60\n meta:\n up: true\n regions:\n - name: east\n meta:\n georegion: US-EAST\n - name: usa\n meta:\n country: US\n answers:\n - answer: sub1.${tld.zone}\n region: east\n meta:\n up: '{\"feed\":\"${foo.id}\"}'\n - answer: sub2.${tld.zone}\n meta:\n up: '{\"feed\":\"${bar.id}\"}'\n connections: 3\n - answer: sub3.${tld.zone}\n meta:\n pulsar:\n fn::toJSON:\n - job_id: abcdef\n bias: '*0.55'\n a5m_cutoff: 0.9\n subdivisions:\n fn::toJSON:\n BR:\n - SP\n - SC\n DZ:\n - '01'\n - '02'\n - '03'\n filters:\n - filter: select_first_n\n config:\n N: 1\n # Some other non-NS1 provider that returns a zone with a trailing dot and a domain with a leading dot.\n baz:\n type: external:source\n properties:\n zone: terraform.example.io.\n domain: .www.terraform.example.io\n # Basic record showing how to clean a zone or domain field that comes from\n # another non-NS1 resource. DNS names often end in '.' characters to signify\n # the root of the DNS tree, but the NS1 provider does not support this.\n #\n # In other cases, a domain or zone may be passed in with a preceding dot ('.')\n # character which would likewise lead the system to fail.\n external:\n type: ns1:Record\n properties:\n zone:\n fn::invoke:\n Function: std:replace\n Arguments:\n text: ${zone}\n search: /(^\\.)|(\\.$)/\n replace:\n Return: result\n domain:\n fn::invoke:\n Function: std:replace\n Arguments:\n text: ${domain}\n search: /(^\\.)|(\\.$)/\n replace:\n Return: result\n type: CNAME\n```\n\u003c!--End PulumiCodeChooser --\u003e\n\n## NS1 Documentation\n\n[Record Api Doc](https://ns1.com/api#records)\n\n## Import\n\n```sh\n$ pulumi import ns1:index/record:Record \u003cname\u003e \u003czone\u003e/\u003cdomain\u003e/\u003ctype\u003e`\n```\n\nSo for the example above:\n\n```sh\n$ pulumi import ns1:index/record:Record www terraform.example.io/www.terraform.example.io/CNAME`\n```\n\n", + "description": "Provides a NS1 Record resource. This can be used to create, modify, and delete records.\n\n## Example Usage\n\n\u003c!--Start PulumiCodeChooser --\u003e\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as external from \"@pulumi/external\";\nimport * as ns1 from \"@pulumi/ns1\";\nimport * as std from \"@pulumi/std\";\n\nconst example = new ns1.Zone(\"example\", {zone: \"terraform.example.io\"});\nconst ns1 = new ns1.DataSource(\"ns1\", {\n name: \"ns1_source\",\n sourcetype: \"nsone_v1\",\n});\nconst foo = new ns1.DataFeed(\"foo\", {\n name: \"foo_feed\",\n sourceId: ns1.id,\n config: {\n label: \"foo\",\n },\n});\nconst bar = new ns1.DataFeed(\"bar\", {\n name: \"bar_feed\",\n sourceId: ns1.id,\n config: {\n label: \"bar\",\n },\n});\nconst www = new ns1.Record(\"www\", {\n zone: tld.zone,\n domain: `www.${tld.zone}`,\n type: \"CNAME\",\n ttl: 60,\n meta: {\n up: true,\n },\n regions: [\n {\n name: \"east\",\n meta: {\n georegion: \"US-EAST\",\n },\n },\n {\n name: \"usa\",\n meta: {\n country: \"US\",\n },\n },\n ],\n answers: [\n {\n answer: `sub1.${tld.zone}`,\n region: \"east\",\n meta: {\n up: pulumi.interpolate`{\"feed\":\"${foo.id}\"}`,\n },\n },\n {\n answer: `sub2.${tld.zone}`,\n meta: {\n up: pulumi.interpolate`{\"feed\":\"${bar.id}\"}`,\n connections: 3,\n },\n },\n {\n answer: `sub3.${tld.zone}`,\n meta: {\n pulsar: JSON.stringify([{\n job_id: \"abcdef\",\n bias: \"*0.55\",\n a5m_cutoff: 0.9,\n }]),\n subdivisions: JSON.stringify({\n BR: [\n \"SP\",\n \"SC\",\n ],\n DZ: [\n \"01\",\n \"02\",\n \"03\",\n ],\n }),\n },\n },\n ],\n filters: [{\n filter: \"select_first_n\",\n config: {\n N: 1,\n },\n }],\n});\n// Some other non-NS1 provider that returns a zone with a trailing dot and a domain with a leading dot.\nconst baz = new external.index.Source(\"baz\", {\n zone: \"terraform.example.io.\",\n domain: \".www.terraform.example.io\",\n});\n// Basic record showing how to clean a zone or domain field that comes from\n// another non-NS1 resource. DNS names often end in '.' characters to signify\n// the root of the DNS tree, but the NS1 provider does not support this.\n//\n// In other cases, a domain or zone may be passed in with a preceding dot ('.')\n// character which would likewise lead the system to fail.\nconst external = new ns1.Record(\"external\", {\n zone: std.replace({\n text: zone,\n search: \"/(^\\\\.)|(\\\\.$)/\",\n replace: \"\",\n }).then(invoke =\u003e invoke.result),\n domain: std.replace({\n text: domain,\n search: \"/(^\\\\.)|(\\\\.$)/\",\n replace: \"\",\n }).then(invoke =\u003e invoke.result),\n type: \"CNAME\",\n});\n```\n```python\nimport pulumi\nimport json\nimport pulumi_external as external\nimport pulumi_ns1 as ns1\nimport pulumi_std as std\n\nexample = ns1.Zone(\"example\", zone=\"terraform.example.io\")\nns1 = ns1.DataSource(\"ns1\",\n name=\"ns1_source\",\n sourcetype=\"nsone_v1\")\nfoo = ns1.DataFeed(\"foo\",\n name=\"foo_feed\",\n source_id=ns1.id,\n config={\n \"label\": \"foo\",\n })\nbar = ns1.DataFeed(\"bar\",\n name=\"bar_feed\",\n source_id=ns1.id,\n config={\n \"label\": \"bar\",\n })\nwww = ns1.Record(\"www\",\n zone=tld[\"zone\"],\n domain=f\"www.{tld['zone']}\",\n type=\"CNAME\",\n ttl=60,\n meta={\n \"up\": True,\n },\n regions=[\n ns1.RecordRegionArgs(\n name=\"east\",\n meta={\n \"georegion\": \"US-EAST\",\n },\n ),\n ns1.RecordRegionArgs(\n name=\"usa\",\n meta={\n \"country\": \"US\",\n },\n ),\n ],\n answers=[\n ns1.RecordAnswerArgs(\n answer=f\"sub1.{tld['zone']}\",\n region=\"east\",\n meta={\n \"up\": foo.id.apply(lambda id: f\"{{\\\"feed\\\":\\\"{id}\\\"}}\"),\n },\n ),\n ns1.RecordAnswerArgs(\n answer=f\"sub2.{tld['zone']}\",\n meta={\n \"up\": bar.id.apply(lambda id: f\"{{\\\"feed\\\":\\\"{id}\\\"}}\"),\n \"connections\": 3,\n },\n ),\n ns1.RecordAnswerArgs(\n answer=f\"sub3.{tld['zone']}\",\n meta={\n \"pulsar\": json.dumps([{\n \"job_id\": \"abcdef\",\n \"bias\": \"*0.55\",\n \"a5m_cutoff\": 0.9,\n }]),\n \"subdivisions\": json.dumps({\n \"BR\": [\n \"SP\",\n \"SC\",\n ],\n \"DZ\": [\n \"01\",\n \"02\",\n \"03\",\n ],\n }),\n },\n ),\n ],\n filters=[ns1.RecordFilterArgs(\n filter=\"select_first_n\",\n config={\n \"N\": 1,\n },\n )])\n# Some other non-NS1 provider that returns a zone with a trailing dot and a domain with a leading dot.\nbaz = external.index.Source(\"baz\",\n zone=terraform.example.io.,\n domain=.www.terraform.example.io)\n# Basic record showing how to clean a zone or domain field that comes from\n# another non-NS1 resource. DNS names often end in '.' characters to signify\n# the root of the DNS tree, but the NS1 provider does not support this.\n#\n# In other cases, a domain or zone may be passed in with a preceding dot ('.')\n# character which would likewise lead the system to fail.\nexternal = ns1.Record(\"external\",\n zone=std.replace(text=zone,\n search=\"/(^\\\\.)|(\\\\.$)/\",\n replace=\"\").result,\n domain=std.replace(text=domain,\n search=\"/(^\\\\.)|(\\\\.$)/\",\n replace=\"\").result,\n type=\"CNAME\")\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.Json;\nusing Pulumi;\nusing External = Pulumi.External;\nusing Ns1 = Pulumi.Ns1;\nusing Std = Pulumi.Std;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var example = new Ns1.Zone(\"example\", new()\n {\n ZoneName = \"terraform.example.io\",\n });\n\n var ns1 = new Ns1.DataSource(\"ns1\", new()\n {\n Name = \"ns1_source\",\n Sourcetype = \"nsone_v1\",\n });\n\n var foo = new Ns1.DataFeed(\"foo\", new()\n {\n Name = \"foo_feed\",\n SourceId = ns1.Id,\n Config = \n {\n { \"label\", \"foo\" },\n },\n });\n\n var bar = new Ns1.DataFeed(\"bar\", new()\n {\n Name = \"bar_feed\",\n SourceId = ns1.Id,\n Config = \n {\n { \"label\", \"bar\" },\n },\n });\n\n var www = new Ns1.Record(\"www\", new()\n {\n Zone = tld.Zone,\n Domain = $\"www.{tld.Zone}\",\n Type = \"CNAME\",\n Ttl = 60,\n Meta = \n {\n { \"up\", true },\n },\n Regions = new[]\n {\n new Ns1.Inputs.RecordRegionArgs\n {\n Name = \"east\",\n Meta = \n {\n { \"georegion\", \"US-EAST\" },\n },\n },\n new Ns1.Inputs.RecordRegionArgs\n {\n Name = \"usa\",\n Meta = \n {\n { \"country\", \"US\" },\n },\n },\n },\n Answers = new[]\n {\n new Ns1.Inputs.RecordAnswerArgs\n {\n Answer = $\"sub1.{tld.Zone}\",\n Region = \"east\",\n Meta = \n {\n { \"up\", foo.Id.Apply(id =\u003e $\"{{\\\"feed\\\":\\\"{id}\\\"}}\") },\n },\n },\n new Ns1.Inputs.RecordAnswerArgs\n {\n Answer = $\"sub2.{tld.Zone}\",\n Meta = \n {\n { \"up\", bar.Id.Apply(id =\u003e $\"{{\\\"feed\\\":\\\"{id}\\\"}}\") },\n { \"connections\", 3 },\n },\n },\n new Ns1.Inputs.RecordAnswerArgs\n {\n Answer = $\"sub3.{tld.Zone}\",\n Meta = \n {\n { \"pulsar\", JsonSerializer.Serialize(new[]\n {\n new Dictionary\u003cstring, object?\u003e\n {\n [\"job_id\"] = \"abcdef\",\n [\"bias\"] = \"*0.55\",\n [\"a5m_cutoff\"] = 0.9,\n },\n }) },\n { \"subdivisions\", JsonSerializer.Serialize(new Dictionary\u003cstring, object?\u003e\n {\n [\"BR\"] = new[]\n {\n \"SP\",\n \"SC\",\n },\n [\"DZ\"] = new[]\n {\n \"01\",\n \"02\",\n \"03\",\n },\n }) },\n },\n },\n },\n Filters = new[]\n {\n new Ns1.Inputs.RecordFilterArgs\n {\n Filter = \"select_first_n\",\n Config = \n {\n { \"N\", 1 },\n },\n },\n },\n });\n\n // Some other non-NS1 provider that returns a zone with a trailing dot and a domain with a leading dot.\n var baz = new External.Index.Source(\"baz\", new()\n {\n Zone = \"terraform.example.io.\",\n Domain = \".www.terraform.example.io\",\n });\n\n // Basic record showing how to clean a zone or domain field that comes from\n // another non-NS1 resource. DNS names often end in '.' characters to signify\n // the root of the DNS tree, but the NS1 provider does not support this.\n //\n // In other cases, a domain or zone may be passed in with a preceding dot ('.')\n // character which would likewise lead the system to fail.\n var external = new Ns1.Record(\"external\", new()\n {\n Zone = Std.Replace.Invoke(new()\n {\n Text = zone,\n Search = \"/(^\\\\.)|(\\\\.$)/\",\n Replace = \"\",\n }).Apply(invoke =\u003e invoke.Result),\n Domain = Std.Replace.Invoke(new()\n {\n Text = domain,\n Search = \"/(^\\\\.)|(\\\\.$)/\",\n Replace = \"\",\n }).Apply(invoke =\u003e invoke.Result),\n Type = \"CNAME\",\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\n\t\"github.com/pulumi/pulumi-external/sdk/v1/go/external\"\n\t\"github.com/pulumi/pulumi-ns1/sdk/v3/go/ns1\"\n\t\"github.com/pulumi/pulumi-std/sdk/go/std\"\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.NewZone(ctx, \"example\", \u0026ns1.ZoneArgs{\n\t\t\tZone: pulumi.String(\"terraform.example.io\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tns1, err := ns1.NewDataSource(ctx, \"ns1\", \u0026ns1.DataSourceArgs{\n\t\t\tName: pulumi.String(\"ns1_source\"),\n\t\t\tSourcetype: pulumi.String(\"nsone_v1\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfoo, err := ns1.NewDataFeed(ctx, \"foo\", \u0026ns1.DataFeedArgs{\n\t\t\tName: pulumi.String(\"foo_feed\"),\n\t\t\tSourceId: ns1.ID(),\n\t\t\tConfig: pulumi.Map{\n\t\t\t\t\"label\": pulumi.Any(\"foo\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbar, err := ns1.NewDataFeed(ctx, \"bar\", \u0026ns1.DataFeedArgs{\n\t\t\tName: pulumi.String(\"bar_feed\"),\n\t\t\tSourceId: ns1.ID(),\n\t\t\tConfig: pulumi.Map{\n\t\t\t\t\"label\": pulumi.Any(\"bar\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttmpJSON0, err := json.Marshal([]map[string]interface{}{\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"job_id\": \"abcdef\",\n\t\t\t\t\"bias\": \"*0.55\",\n\t\t\t\t\"a5m_cutoff\": 0.9,\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tjson0 := string(tmpJSON0)\n\t\ttmpJSON1, err := json.Marshal(map[string]interface{}{\n\t\t\t\"BR\": []string{\n\t\t\t\t\"SP\",\n\t\t\t\t\"SC\",\n\t\t\t},\n\t\t\t\"DZ\": []string{\n\t\t\t\t\"01\",\n\t\t\t\t\"02\",\n\t\t\t\t\"03\",\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tjson1 := string(tmpJSON1)\n\t\t_, err = ns1.NewRecord(ctx, \"www\", \u0026ns1.RecordArgs{\n\t\t\tZone: pulumi.Any(tld.Zone),\n\t\t\tDomain: pulumi.String(fmt.Sprintf(\"www.%v\", tld.Zone)),\n\t\t\tType: pulumi.String(\"CNAME\"),\n\t\t\tTtl: pulumi.Int(60),\n\t\t\tMeta: pulumi.Map{\n\t\t\t\t\"up\": pulumi.Any(true),\n\t\t\t},\n\t\t\tRegions: ns1.RecordRegionArray{\n\t\t\t\t\u0026ns1.RecordRegionArgs{\n\t\t\t\t\tName: pulumi.String(\"east\"),\n\t\t\t\t\tMeta: pulumi.Map{\n\t\t\t\t\t\t\"georegion\": pulumi.Any(\"US-EAST\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\u0026ns1.RecordRegionArgs{\n\t\t\t\t\tName: pulumi.String(\"usa\"),\n\t\t\t\t\tMeta: pulumi.Map{\n\t\t\t\t\t\t\"country\": pulumi.Any(\"US\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tAnswers: ns1.RecordAnswerArray{\n\t\t\t\t\u0026ns1.RecordAnswerArgs{\n\t\t\t\t\tAnswer: pulumi.String(fmt.Sprintf(\"sub1.%v\", tld.Zone)),\n\t\t\t\t\tRegion: pulumi.String(\"east\"),\n\t\t\t\t\tMeta: pulumi.Map{\n\t\t\t\t\t\t\"up\": foo.ID().ApplyT(func(id string) (string, error) {\n\t\t\t\t\t\t\treturn fmt.Sprintf(\"{\\\"feed\\\":\\\"%v\\\"}\", id), nil\n\t\t\t\t\t\t}).(pulumi.StringOutput),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\u0026ns1.RecordAnswerArgs{\n\t\t\t\t\tAnswer: pulumi.String(fmt.Sprintf(\"sub2.%v\", tld.Zone)),\n\t\t\t\t\tMeta: pulumi.Map{\n\t\t\t\t\t\t\"up\": bar.ID().ApplyT(func(id string) (string, error) {\n\t\t\t\t\t\t\treturn fmt.Sprintf(\"{\\\"feed\\\":\\\"%v\\\"}\", id), nil\n\t\t\t\t\t\t}).(pulumi.StringOutput),\n\t\t\t\t\t\t\"connections\": pulumi.Any(3),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\u0026ns1.RecordAnswerArgs{\n\t\t\t\t\tAnswer: pulumi.String(fmt.Sprintf(\"sub3.%v\", tld.Zone)),\n\t\t\t\t\tMeta: pulumi.Map{\n\t\t\t\t\t\t\"pulsar\": pulumi.String(json0),\n\t\t\t\t\t\t\"subdivisions\": pulumi.String(json1),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tFilters: ns1.RecordFilterArray{\n\t\t\t\t\u0026ns1.RecordFilterArgs{\n\t\t\t\t\tFilter: pulumi.String(\"select_first_n\"),\n\t\t\t\t\tConfig: pulumi.Map{\n\t\t\t\t\t\t\"N\": pulumi.Any(1),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Some other non-NS1 provider that returns a zone with a trailing dot and a domain with a leading dot.\n\t\t_, err = index.NewSource(ctx, \"baz\", \u0026index.SourceArgs{\n\t\t\tZone: \"terraform.example.io.\",\n\t\t\tDomain: \".www.terraform.example.io\",\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tinvokeReplace, err := std.Replace(ctx, \u0026std.ReplaceArgs{\n\t\t\tText: zone,\n\t\t\tSearch: \"/(^\\\\.)|(\\\\.$)/\",\n\t\t\tReplace: \"\",\n\t\t}, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tinvokeReplace1, err := std.Replace(ctx, \u0026std.ReplaceArgs{\n\t\t\tText: domain,\n\t\t\tSearch: \"/(^\\\\.)|(\\\\.$)/\",\n\t\t\tReplace: \"\",\n\t\t}, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Basic record showing how to clean a zone or domain field that comes from\n\t\t// another non-NS1 resource. DNS names often end in '.' characters to signify\n\t\t// the root of the DNS tree, but the NS1 provider does not support this.\n\t\t//\n\t\t// In other cases, a domain or zone may be passed in with a preceding dot ('.')\n\t\t// character which would likewise lead the system to fail.\n\t\t_, err = ns1.NewRecord(ctx, \"external\", \u0026ns1.RecordArgs{\n\t\t\tZone: invokeReplace.Result,\n\t\t\tDomain: invokeReplace1.Result,\n\t\t\tType: pulumi.String(\"CNAME\"),\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.Zone;\nimport com.pulumi.ns1.ZoneArgs;\nimport com.pulumi.ns1.DataSource;\nimport com.pulumi.ns1.DataSourceArgs;\nimport com.pulumi.ns1.DataFeed;\nimport com.pulumi.ns1.DataFeedArgs;\nimport com.pulumi.ns1.Record;\nimport com.pulumi.ns1.RecordArgs;\nimport com.pulumi.ns1.inputs.RecordRegionArgs;\nimport com.pulumi.ns1.inputs.RecordAnswerArgs;\nimport com.pulumi.ns1.inputs.RecordFilterArgs;\nimport com.pulumi.external.source;\nimport com.pulumi.external.SourceArgs;\nimport static com.pulumi.codegen.internal.Serialization.*;\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 Zone(\"example\", ZoneArgs.builder()\n .zone(\"terraform.example.io\")\n .build());\n\n var ns1 = new DataSource(\"ns1\", DataSourceArgs.builder()\n .name(\"ns1_source\")\n .sourcetype(\"nsone_v1\")\n .build());\n\n var foo = new DataFeed(\"foo\", DataFeedArgs.builder()\n .name(\"foo_feed\")\n .sourceId(ns1.id())\n .config(Map.of(\"label\", \"foo\"))\n .build());\n\n var bar = new DataFeed(\"bar\", DataFeedArgs.builder()\n .name(\"bar_feed\")\n .sourceId(ns1.id())\n .config(Map.of(\"label\", \"bar\"))\n .build());\n\n var www = new Record(\"www\", RecordArgs.builder()\n .zone(tld.zone())\n .domain(String.format(\"www.%s\", tld.zone()))\n .type(\"CNAME\")\n .ttl(60)\n .meta(Map.of(\"up\", true))\n .regions( \n RecordRegionArgs.builder()\n .name(\"east\")\n .meta(Map.of(\"georegion\", \"US-EAST\"))\n .build(),\n RecordRegionArgs.builder()\n .name(\"usa\")\n .meta(Map.of(\"country\", \"US\"))\n .build())\n .answers( \n RecordAnswerArgs.builder()\n .answer(String.format(\"sub1.%s\", tld.zone()))\n .region(\"east\")\n .meta(Map.of(\"up\", foo.id().applyValue(id -\u003e String.format(\"{{\\\"feed\\\":\\\"%s\\\"}}\", id))))\n .build(),\n RecordAnswerArgs.builder()\n .answer(String.format(\"sub2.%s\", tld.zone()))\n .meta(Map.ofEntries(\n Map.entry(\"up\", bar.id().applyValue(id -\u003e String.format(\"{{\\\"feed\\\":\\\"%s\\\"}}\", id))),\n Map.entry(\"connections\", 3)\n ))\n .build(),\n RecordAnswerArgs.builder()\n .answer(String.format(\"sub3.%s\", tld.zone()))\n .meta(Map.ofEntries(\n Map.entry(\"pulsar\", serializeJson(\n jsonArray(jsonObject(\n jsonProperty(\"job_id\", \"abcdef\"),\n jsonProperty(\"bias\", \"*0.55\"),\n jsonProperty(\"a5m_cutoff\", 0.9)\n )))),\n Map.entry(\"subdivisions\", serializeJson(\n jsonObject(\n jsonProperty(\"BR\", jsonArray(\n \"SP\", \n \"SC\"\n )),\n jsonProperty(\"DZ\", jsonArray(\n \"01\", \n \"02\", \n \"03\"\n ))\n )))\n ))\n .build())\n .filters(RecordFilterArgs.builder()\n .filter(\"select_first_n\")\n .config(Map.of(\"N\", 1))\n .build())\n .build());\n\n // Some other non-NS1 provider that returns a zone with a trailing dot and a domain with a leading dot.\n var baz = new Source(\"baz\", SourceArgs.builder()\n .zone(\"terraform.example.io.\")\n .domain(\".www.terraform.example.io\")\n .build());\n\n // Basic record showing how to clean a zone or domain field that comes from\n // another non-NS1 resource. DNS names often end in '.' characters to signify\n // the root of the DNS tree, but the NS1 provider does not support this.\n //\n // In other cases, a domain or zone may be passed in with a preceding dot ('.')\n // character which would likewise lead the system to fail.\n var external = new Record(\"external\", RecordArgs.builder()\n .zone(StdFunctions.replace(ReplaceArgs.builder()\n .text(zone)\n .search(\"/(^\\\\.)|(\\\\.$)/\")\n .replace(\"\")\n .build()).result())\n .domain(StdFunctions.replace(ReplaceArgs.builder()\n .text(domain)\n .search(\"/(^\\\\.)|(\\\\.$)/\")\n .replace(\"\")\n .build()).result())\n .type(\"CNAME\")\n .build());\n\n }\n}\n```\n```yaml\nresources:\n example:\n type: ns1:Zone\n properties:\n zone: terraform.example.io\n ns1:\n type: ns1:DataSource\n properties:\n name: ns1_source\n sourcetype: nsone_v1\n foo:\n type: ns1:DataFeed\n properties:\n name: foo_feed\n sourceId: ${ns1.id}\n config:\n label: foo\n bar:\n type: ns1:DataFeed\n properties:\n name: bar_feed\n sourceId: ${ns1.id}\n config:\n label: bar\n www:\n type: ns1:Record\n properties:\n zone: ${tld.zone}\n domain: www.${tld.zone}\n type: CNAME\n ttl: 60\n meta:\n up: true\n regions:\n - name: east\n meta:\n georegion: US-EAST\n - name: usa\n meta:\n country: US\n answers:\n - answer: sub1.${tld.zone}\n region: east\n meta:\n up: '{\"feed\":\"${foo.id}\"}'\n - answer: sub2.${tld.zone}\n meta:\n up: '{\"feed\":\"${bar.id}\"}'\n connections: 3\n - answer: sub3.${tld.zone}\n meta:\n pulsar:\n fn::toJSON:\n - job_id: abcdef\n bias: '*0.55'\n a5m_cutoff: 0.9\n subdivisions:\n fn::toJSON:\n BR:\n - SP\n - SC\n DZ:\n - '01'\n - '02'\n - '03'\n filters:\n - filter: select_first_n\n config:\n N: 1\n # Some other non-NS1 provider that returns a zone with a trailing dot and a domain with a leading dot.\n baz:\n type: external:source\n properties:\n zone: terraform.example.io.\n domain: .www.terraform.example.io\n # Basic record showing how to clean a zone or domain field that comes from\n # another non-NS1 resource. DNS names often end in '.' characters to signify\n # the root of the DNS tree, but the NS1 provider does not support this.\n #\n # In other cases, a domain or zone may be passed in with a preceding dot ('.')\n # character which would likewise lead the system to fail.\n external:\n type: ns1:Record\n properties:\n zone:\n fn::invoke:\n Function: std:replace\n Arguments:\n text: ${zone}\n search: /(^\\.)|(\\.$)/\n replace:\n Return: result\n domain:\n fn::invoke:\n Function: std:replace\n Arguments:\n text: ${domain}\n search: /(^\\.)|(\\.$)/\n replace:\n Return: result\n type: CNAME\n```\n\u003c!--End PulumiCodeChooser --\u003e\n\n## NS1 Documentation\n\n[Record Api Doc](https://ns1.com/api#records)\n\n## Import\n\n```sh\n$ pulumi import ns1:index/record:Record \u003cname\u003e \u003czone\u003e/\u003cdomain\u003e/\u003ctype\u003e`\n```\n\nSo for the example above:\n\n```sh\n$ pulumi import ns1:index/record:Record www terraform.example.io/www.terraform.example.io/CNAME`\n```\n\n", "properties": { "answers": { "type": "array", diff --git a/sdk/go/ns1/record.go b/sdk/go/ns1/record.go index d8ae936..474e6e1 100644 --- a/sdk/go/ns1/record.go +++ b/sdk/go/ns1/record.go @@ -24,7 +24,7 @@ import ( // "encoding/json" // "fmt" // -// "github.com/pulumi/pulumi-external/sdk/go/external" +// "github.com/pulumi/pulumi-external/sdk/v1/go/external" // "github.com/pulumi/pulumi-ns1/sdk/v3/go/ns1" // "github.com/pulumi/pulumi-std/sdk/go/std" // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" @@ -154,7 +154,7 @@ import ( // return err // } // // Some other non-NS1 provider that returns a zone with a trailing dot and a domain with a leading dot. -// _, err = external.NewSource(ctx, "baz", &external.SourceArgs{ +// _, err = index.NewSource(ctx, "baz", &index.SourceArgs{ // Zone: "terraform.example.io.", // Domain: ".www.terraform.example.io", // })