From 86ffe1da355090b085b9825bf19ef12fcf491b8d Mon Sep 17 00:00:00 2001 From: Pulumi Bot <30351955+pulumi-bot@users.noreply.github.com> Date: Thu, 27 Jul 2023 01:11:16 -0700 Subject: [PATCH] Upgrade terraform-provider-opsgenie to v0.6.29 (#165) * make tfgen * make build_sdks --------- Co-authored-by: pulumi-bot --- provider/go.mod | 10 +-- provider/go.sum | 21 ++--- sdk/go/opsgenie/alertPolicy.go | 2 + sdk/go/opsgenie/apiIntegration.go | 2 + sdk/go/opsgenie/config/config.go | 5 +- sdk/go/opsgenie/customRole.go | 2 + sdk/go/opsgenie/emailIntegration.go | 2 + sdk/go/opsgenie/escalation.go | 2 + sdk/go/opsgenie/getEscalation.go | 2 + sdk/go/opsgenie/getHeartbeat.go | 2 + sdk/go/opsgenie/getSchedule.go | 2 + sdk/go/opsgenie/getService.go | 2 + sdk/go/opsgenie/getTeam.go | 2 + sdk/go/opsgenie/getUser.go | 2 + sdk/go/opsgenie/heartbeat.go | 2 + sdk/go/opsgenie/incidentTemplate.go | 2 + sdk/go/opsgenie/init.go | 6 +- sdk/go/opsgenie/integrationAction.go | 2 + .../{config => internal}/pulumiUtilities.go | 40 +++++++-- sdk/go/opsgenie/internal/pulumiVersion.go | 11 +++ sdk/go/opsgenie/maintenance.go | 2 + sdk/go/opsgenie/notificationPolicy.go | 2 + sdk/go/opsgenie/notificationRule.go | 2 + sdk/go/opsgenie/provider.go | 4 +- sdk/go/opsgenie/pulumiTypes.go | 3 + sdk/go/opsgenie/pulumiUtilities.go | 87 ------------------- sdk/go/opsgenie/schedule.go | 2 + sdk/go/opsgenie/scheduleRotation.go | 2 + sdk/go/opsgenie/service.go | 2 + sdk/go/opsgenie/serviceIncidentRule.go | 2 + sdk/go/opsgenie/team.go | 2 + sdk/go/opsgenie/teamRoutingRule.go | 2 + sdk/go/opsgenie/user.go | 2 + sdk/go/opsgenie/userContact.go | 2 + sdk/nodejs/provider.ts | 2 +- 35 files changed, 126 insertions(+), 113 deletions(-) rename sdk/go/opsgenie/{config => internal}/pulumiUtilities.go (60%) create mode 100644 sdk/go/opsgenie/internal/pulumiVersion.go delete mode 100644 sdk/go/opsgenie/pulumiUtilities.go diff --git a/provider/go.mod b/provider/go.mod index b9032cf1..9b917213 100644 --- a/provider/go.mod +++ b/provider/go.mod @@ -8,9 +8,9 @@ replace ( ) require ( - github.com/opsgenie/terraform-provider-opsgenie v0.6.28 - github.com/pulumi/pulumi-terraform-bridge/v3 v3.53.0 - github.com/pulumi/pulumi/sdk/v3 v3.73.1-0.20230623071431-db579129f4c9 + github.com/opsgenie/terraform-provider-opsgenie v0.6.29 + github.com/pulumi/pulumi-terraform-bridge/v3 v3.54.2 + github.com/pulumi/pulumi/sdk/v3 v3.75.0 ) require ( @@ -182,7 +182,7 @@ require ( github.com/pulumi/pulumi-java/pkg v0.9.4 // indirect github.com/pulumi/pulumi-terraform-bridge/x/muxer v0.0.4 // indirect github.com/pulumi/pulumi-yaml v1.1.1 // indirect - github.com/pulumi/pulumi/pkg/v3 v3.73.1-0.20230623071431-db579129f4c9 // indirect + github.com/pulumi/pulumi/pkg/v3 v3.75.0 // indirect github.com/pulumi/schema-tools v0.1.2 // indirect github.com/pulumi/terraform-diff-reader v0.0.2 // indirect github.com/rivo/uniseg v0.4.4 // indirect @@ -232,7 +232,7 @@ require ( google.golang.org/api v0.114.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect - google.golang.org/grpc v1.56.0 // indirect + google.golang.org/grpc v1.56.1 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/square/go-jose.v2 v2.6.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/provider/go.sum b/provider/go.sum index c2aebb63..a48ad1c6 100644 --- a/provider/go.sum +++ b/provider/go.sum @@ -1665,7 +1665,7 @@ github.com/hexops/autogold v1.3.0 h1:IEtGNPxBeBu8RMn8eKWh/Ll9dVNgSnJ7bp/qHgMQ14o github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/valast v1.4.0 h1:sFzyxPDP0riFQUzSBXTCCrAbbIndHPWMndxuEjXdZlc= github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= -github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog= +github.com/hinshun/vt10x v0.0.0-20220301184237-5011da428d02 h1:AgcIVYPa6XJnU3phs104wLj8l5GEththEw6+F79YsIY= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= @@ -2036,8 +2036,8 @@ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.20 h1:twA4Kiaw+Vi4x5Ei3qDO1TtQf7oSuJQ+CqJB9j9lEmQ= github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.20/go.mod h1:4OjcxgwdXzezqytxN534MooNmrxRD50geWZxTD7845s= -github.com/opsgenie/terraform-provider-opsgenie v0.6.28 h1:bmwZ6bs4fP8zzVFPK1Ls3ZSjtVCQAYSVFyma0r5Al8o= -github.com/opsgenie/terraform-provider-opsgenie v0.6.28/go.mod h1:UB2SNie9LEetVZcR3YWm5CACxKHZfORoqMEp7Nq4tCI= +github.com/opsgenie/terraform-provider-opsgenie v0.6.29 h1:jy+PkdaEpAQFm8CJ5b+KavZeS+1zUiAbPnmTzQK4xGY= +github.com/opsgenie/terraform-provider-opsgenie v0.6.29/go.mod h1:UB2SNie9LEetVZcR3YWm5CACxKHZfORoqMEp7Nq4tCI= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= @@ -2143,16 +2143,16 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/pulumi/pulumi-java/pkg v0.9.4 h1:gIQZmlUI1o9ye8CL2XFqtmAX6Lwr9uj/+HzjboiSmK4= github.com/pulumi/pulumi-java/pkg v0.9.4/go.mod h1:c6rSw/+q4O0IImgJ9axxoC6QesbPYWBaG5gimbHouUQ= github.com/pulumi/pulumi-terraform-bridge/testing v0.0.1 h1:SCg1gjfY9N4yn8U8peIUYATifjoDABkyR7H9lmefsfc= -github.com/pulumi/pulumi-terraform-bridge/v3 v3.53.0 h1:XP754+36CpyiT5tEzqd43U8gYGqDML9hkiWMaoV0WG0= -github.com/pulumi/pulumi-terraform-bridge/v3 v3.53.0/go.mod h1:Bm1kuEs0xouFxEG2Lv/I3OhnME+VId9DbkRClnwFqsI= +github.com/pulumi/pulumi-terraform-bridge/v3 v3.54.2 h1:ur1BqYZKadvCnqAeuPzTwJSfHBnDIRopX37ewRPPdPo= +github.com/pulumi/pulumi-terraform-bridge/v3 v3.54.2/go.mod h1:OgOp9PzeKBBqWRZ87VX+amwG8Jt1V1pI+/WZ5dGkYG8= github.com/pulumi/pulumi-terraform-bridge/x/muxer v0.0.4 h1:rIzMmtcVpPX8ynaz6/nW5AHNY63DiNfCohqmxWvMpM4= github.com/pulumi/pulumi-terraform-bridge/x/muxer v0.0.4/go.mod h1:Kt8RIZWa/N8rW3+0g6NrqCBmF3o+HuIhFaZpssEkG6w= github.com/pulumi/pulumi-yaml v1.1.1 h1:8pyBNIU8+ym0wYpjhsCqN+cutygfK1XbhY2YEeNfyXY= github.com/pulumi/pulumi-yaml v1.1.1/go.mod h1:GhpdS6rFpwqvUtKdA+fQy8P28iNvncng39IXh5q68vE= -github.com/pulumi/pulumi/pkg/v3 v3.73.1-0.20230623071431-db579129f4c9 h1:kZqHt7gZIhBxzE2N+WuyI6Z9nN/YnR6x1mNie3Wldvw= -github.com/pulumi/pulumi/pkg/v3 v3.73.1-0.20230623071431-db579129f4c9/go.mod h1:uioQQOTP9OUSIDga3MuDVnR3OThhWjByoe1M38VxhwI= -github.com/pulumi/pulumi/sdk/v3 v3.73.1-0.20230623071431-db579129f4c9 h1:w/8QHBnDZz8d+aHhBSjyuH7G67LkFgY3xVtAkbE2OII= -github.com/pulumi/pulumi/sdk/v3 v3.73.1-0.20230623071431-db579129f4c9/go.mod h1:BUUBfQZsH0FPuznRfFHkR+b96VlXELnn+DgidFj4XSQ= +github.com/pulumi/pulumi/pkg/v3 v3.75.0 h1:oBJ+Ft5VokKJGZHtX5ytyKenMCBH/d1+rsVL5MOGmHo= +github.com/pulumi/pulumi/pkg/v3 v3.75.0/go.mod h1:jzU1sKjOoDMFxxISb4hEK/C1mQsHVheYkWfZPLQRC9c= +github.com/pulumi/pulumi/sdk/v3 v3.75.0 h1:+5V5UOwgHKAaqSD8DKhuTU+RTObqkH3yp/p2EJQYYQk= +github.com/pulumi/pulumi/sdk/v3 v3.75.0/go.mod h1:HiE9Wf+DVrg8Em1D6bxRCdDMsNkj8//vLCST73xH2Hc= github.com/pulumi/schema-tools v0.1.2 h1:Fd9xvUjgck4NA+7/jSk7InqCUT4Kj940+EcnbQKpfZo= github.com/pulumi/schema-tools v0.1.2/go.mod h1:62lgj52Tzq11eqWTIaKd+EVyYAu5dEcDJxMhTjvMO/k= github.com/pulumi/terraform-diff-reader v0.0.2 h1:kTE4nEXU3/SYXESvAIem+wyHMI3abqkI3OhJ0G04LLI= @@ -3348,8 +3348,9 @@ google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsA google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= -google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= +google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/sdk/go/opsgenie/alertPolicy.go b/sdk/go/opsgenie/alertPolicy.go index 272ac7e1..f7ab59b4 100644 --- a/sdk/go/opsgenie/alertPolicy.go +++ b/sdk/go/opsgenie/alertPolicy.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -145,6 +146,7 @@ func NewAlertPolicy(ctx *pulumi.Context, if args.Message == nil { return nil, errors.New("invalid value for required argument 'Message'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource AlertPolicy err := ctx.RegisterResource("opsgenie:index/alertPolicy:AlertPolicy", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/apiIntegration.go b/sdk/go/opsgenie/apiIntegration.go index 3d9ed908..986058f0 100644 --- a/sdk/go/opsgenie/apiIntegration.go +++ b/sdk/go/opsgenie/apiIntegration.go @@ -7,6 +7,7 @@ import ( "context" "reflect" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -130,6 +131,7 @@ func NewApiIntegration(ctx *pulumi.Context, "apiKey", }) opts = append(opts, secrets) + opts = internal.PkgResourceDefaultOpts(opts) var resource ApiIntegration err := ctx.RegisterResource("opsgenie:index/apiIntegration:ApiIntegration", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/config/config.go b/sdk/go/opsgenie/config/config.go index 3a2e20f4..65f580a1 100644 --- a/sdk/go/opsgenie/config/config.go +++ b/sdk/go/opsgenie/config/config.go @@ -4,10 +4,13 @@ package config import ( + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config" ) +var _ = internal.GetEnvOrDefault + func GetApiKey(ctx *pulumi.Context) string { return config.Get(ctx, "opsgenie:apiKey") } @@ -17,7 +20,7 @@ func GetApiUrl(ctx *pulumi.Context) string { return v } var value string - if d := getEnvOrDefault(nil, nil, "OPSGENIE_API_URL"); d != nil { + if d := internal.GetEnvOrDefault(nil, nil, "OPSGENIE_API_URL"); d != nil { value = d.(string) } return value diff --git a/sdk/go/opsgenie/customRole.go b/sdk/go/opsgenie/customRole.go index 281e1ec9..d71b92a3 100644 --- a/sdk/go/opsgenie/customRole.go +++ b/sdk/go/opsgenie/customRole.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -69,6 +70,7 @@ func NewCustomRole(ctx *pulumi.Context, if args.RoleName == nil { return nil, errors.New("invalid value for required argument 'RoleName'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource CustomRole err := ctx.RegisterResource("opsgenie:index/customRole:CustomRole", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/emailIntegration.go b/sdk/go/opsgenie/emailIntegration.go index caacb39e..bb8c48bc 100644 --- a/sdk/go/opsgenie/emailIntegration.go +++ b/sdk/go/opsgenie/emailIntegration.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -119,6 +120,7 @@ func NewEmailIntegration(ctx *pulumi.Context, if args.EmailUsername == nil { return nil, errors.New("invalid value for required argument 'EmailUsername'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource EmailIntegration err := ctx.RegisterResource("opsgenie:index/emailIntegration:EmailIntegration", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/escalation.go b/sdk/go/opsgenie/escalation.go index 859b877d..e5e226ea 100644 --- a/sdk/go/opsgenie/escalation.go +++ b/sdk/go/opsgenie/escalation.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -103,6 +104,7 @@ func NewEscalation(ctx *pulumi.Context, if args.Rules == nil { return nil, errors.New("invalid value for required argument 'Rules'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource Escalation err := ctx.RegisterResource("opsgenie:index/escalation:Escalation", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/getEscalation.go b/sdk/go/opsgenie/getEscalation.go index 8afdb2d5..7bdcabf0 100644 --- a/sdk/go/opsgenie/getEscalation.go +++ b/sdk/go/opsgenie/getEscalation.go @@ -7,6 +7,7 @@ import ( "context" "reflect" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -38,6 +39,7 @@ import ( // // ``` func LookupEscalation(ctx *pulumi.Context, args *LookupEscalationArgs, opts ...pulumi.InvokeOption) (*LookupEscalationResult, error) { + opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupEscalationResult err := ctx.Invoke("opsgenie:index/getEscalation:getEscalation", args, &rv, opts...) if err != nil { diff --git a/sdk/go/opsgenie/getHeartbeat.go b/sdk/go/opsgenie/getHeartbeat.go index afb3806f..8e1a13c8 100644 --- a/sdk/go/opsgenie/getHeartbeat.go +++ b/sdk/go/opsgenie/getHeartbeat.go @@ -7,6 +7,7 @@ import ( "context" "reflect" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -38,6 +39,7 @@ import ( // // ``` func LookupHeartbeat(ctx *pulumi.Context, args *LookupHeartbeatArgs, opts ...pulumi.InvokeOption) (*LookupHeartbeatResult, error) { + opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupHeartbeatResult err := ctx.Invoke("opsgenie:index/getHeartbeat:getHeartbeat", args, &rv, opts...) if err != nil { diff --git a/sdk/go/opsgenie/getSchedule.go b/sdk/go/opsgenie/getSchedule.go index 9b31e9c4..236ed761 100644 --- a/sdk/go/opsgenie/getSchedule.go +++ b/sdk/go/opsgenie/getSchedule.go @@ -7,6 +7,7 @@ import ( "context" "reflect" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -38,6 +39,7 @@ import ( // // ``` func LookupSchedule(ctx *pulumi.Context, args *LookupScheduleArgs, opts ...pulumi.InvokeOption) (*LookupScheduleResult, error) { + opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupScheduleResult err := ctx.Invoke("opsgenie:index/getSchedule:getSchedule", args, &rv, opts...) if err != nil { diff --git a/sdk/go/opsgenie/getService.go b/sdk/go/opsgenie/getService.go index f4dddac9..f44d9311 100644 --- a/sdk/go/opsgenie/getService.go +++ b/sdk/go/opsgenie/getService.go @@ -7,6 +7,7 @@ import ( "context" "reflect" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -38,6 +39,7 @@ import ( // // ``` func LookupService(ctx *pulumi.Context, args *LookupServiceArgs, opts ...pulumi.InvokeOption) (*LookupServiceResult, error) { + opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupServiceResult err := ctx.Invoke("opsgenie:index/getService:getService", args, &rv, opts...) if err != nil { diff --git a/sdk/go/opsgenie/getTeam.go b/sdk/go/opsgenie/getTeam.go index 8790adc8..2d0c360d 100644 --- a/sdk/go/opsgenie/getTeam.go +++ b/sdk/go/opsgenie/getTeam.go @@ -7,6 +7,7 @@ import ( "context" "reflect" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -38,6 +39,7 @@ import ( // // ``` func LookupTeam(ctx *pulumi.Context, args *LookupTeamArgs, opts ...pulumi.InvokeOption) (*LookupTeamResult, error) { + opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupTeamResult err := ctx.Invoke("opsgenie:index/getTeam:getTeam", args, &rv, opts...) if err != nil { diff --git a/sdk/go/opsgenie/getUser.go b/sdk/go/opsgenie/getUser.go index 9c024f9c..c8508dfd 100644 --- a/sdk/go/opsgenie/getUser.go +++ b/sdk/go/opsgenie/getUser.go @@ -7,6 +7,7 @@ import ( "context" "reflect" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -38,6 +39,7 @@ import ( // // ``` func LookupUser(ctx *pulumi.Context, args *LookupUserArgs, opts ...pulumi.InvokeOption) (*LookupUserResult, error) { + opts = internal.PkgInvokeDefaultOpts(opts) var rv LookupUserResult err := ctx.Invoke("opsgenie:index/getUser:getUser", args, &rv, opts...) if err != nil { diff --git a/sdk/go/opsgenie/heartbeat.go b/sdk/go/opsgenie/heartbeat.go index 6ec600b7..f228c4b9 100644 --- a/sdk/go/opsgenie/heartbeat.go +++ b/sdk/go/opsgenie/heartbeat.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -97,6 +98,7 @@ func NewHeartbeat(ctx *pulumi.Context, if args.IntervalUnit == nil { return nil, errors.New("invalid value for required argument 'IntervalUnit'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource Heartbeat err := ctx.RegisterResource("opsgenie:index/heartbeat:Heartbeat", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/incidentTemplate.go b/sdk/go/opsgenie/incidentTemplate.go index 47da6967..ab3444ec 100644 --- a/sdk/go/opsgenie/incidentTemplate.go +++ b/sdk/go/opsgenie/incidentTemplate.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -115,6 +116,7 @@ func NewIncidentTemplate(ctx *pulumi.Context, if args.StakeholderProperties == nil { return nil, errors.New("invalid value for required argument 'StakeholderProperties'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource IncidentTemplate err := ctx.RegisterResource("opsgenie:index/incidentTemplate:IncidentTemplate", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/init.go b/sdk/go/opsgenie/init.go index bea12cbc..e1389f65 100644 --- a/sdk/go/opsgenie/init.go +++ b/sdk/go/opsgenie/init.go @@ -7,6 +7,7 @@ import ( "fmt" "github.com/blang/semver" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -85,7 +86,10 @@ func (p *pkg) ConstructProvider(ctx *pulumi.Context, name, typ, urn string) (pul } func init() { - version, _ := PkgVersion() + version, err := internal.PkgVersion() + if err != nil { + version = semver.Version{Major: 1} + } pulumi.RegisterResourceModule( "opsgenie", "index/alertPolicy", diff --git a/sdk/go/opsgenie/integrationAction.go b/sdk/go/opsgenie/integrationAction.go index 3b522f3a..9f543236 100644 --- a/sdk/go/opsgenie/integrationAction.go +++ b/sdk/go/opsgenie/integrationAction.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -43,6 +44,7 @@ func NewIntegrationAction(ctx *pulumi.Context, if args.IntegrationId == nil { return nil, errors.New("invalid value for required argument 'IntegrationId'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource IntegrationAction err := ctx.RegisterResource("opsgenie:index/integrationAction:IntegrationAction", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/config/pulumiUtilities.go b/sdk/go/opsgenie/internal/pulumiUtilities.go similarity index 60% rename from sdk/go/opsgenie/config/pulumiUtilities.go rename to sdk/go/opsgenie/internal/pulumiUtilities.go index 259cffce..fb934803 100644 --- a/sdk/go/opsgenie/config/pulumiUtilities.go +++ b/sdk/go/opsgenie/internal/pulumiUtilities.go @@ -1,7 +1,7 @@ // 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 config +package internal import ( "fmt" @@ -17,7 +17,7 @@ import ( type envParser func(v string) interface{} -func parseEnvBool(v string) interface{} { +func ParseEnvBool(v string) interface{} { b, err := strconv.ParseBool(v) if err != nil { return nil @@ -25,7 +25,7 @@ func parseEnvBool(v string) interface{} { return b } -func parseEnvInt(v string) interface{} { +func ParseEnvInt(v string) interface{} { i, err := strconv.ParseInt(v, 0, 0) if err != nil { return nil @@ -33,7 +33,7 @@ func parseEnvInt(v string) interface{} { return int(i) } -func parseEnvFloat(v string) interface{} { +func ParseEnvFloat(v string) interface{} { f, err := strconv.ParseFloat(v, 64) if err != nil { return nil @@ -41,7 +41,7 @@ func parseEnvFloat(v string) interface{} { return f } -func parseEnvStringArray(v string) interface{} { +func ParseEnvStringArray(v string) interface{} { var result pulumi.StringArray for _, item := range strings.Split(v, ";") { result = append(result, pulumi.String(item)) @@ -49,7 +49,7 @@ func parseEnvStringArray(v string) interface{} { return result } -func getEnvOrDefault(def interface{}, parser envParser, vars ...string) interface{} { +func GetEnvOrDefault(def interface{}, parser envParser, vars ...string) interface{} { for _, v := range vars { if value, ok := os.LookupEnv(v); ok { if parser != nil { @@ -65,6 +65,10 @@ func getEnvOrDefault(def interface{}, parser envParser, vars ...string) interfac // If a version cannot be determined, v1 will be assumed. The second return // value is always nil. func PkgVersion() (semver.Version, error) { + // emptyVersion defaults to v0.0.0 + if !SdkVersion.Equals(semver.Version{}) { + return SdkVersion, nil + } type sentinal struct{} pkgPath := reflect.TypeOf(sentinal{}).PkgPath() re := regexp.MustCompile("^.*/pulumi-opsgenie/sdk(/v\\d+)?") @@ -79,9 +83,31 @@ func PkgVersion() (semver.Version, error) { } // isZero is a null safe check for if a value is it's types zero value. -func isZero(v interface{}) bool { +func IsZero(v interface{}) bool { if v == nil { return true } return reflect.ValueOf(v).IsZero() } + +// PkgResourceDefaultOpts provides package level defaults to pulumi.OptionResource. +func PkgResourceDefaultOpts(opts []pulumi.ResourceOption) []pulumi.ResourceOption { + defaults := []pulumi.ResourceOption{} + + version := SdkVersion + if !version.Equals(semver.Version{}) { + defaults = append(defaults, pulumi.Version(version.String())) + } + return append(defaults, opts...) +} + +// PkgInvokeDefaultOpts provides package level defaults to pulumi.OptionInvoke. +func PkgInvokeDefaultOpts(opts []pulumi.InvokeOption) []pulumi.InvokeOption { + defaults := []pulumi.InvokeOption{} + + version := SdkVersion + if !version.Equals(semver.Version{}) { + defaults = append(defaults, pulumi.Version(version.String())) + } + return append(defaults, opts...) +} diff --git a/sdk/go/opsgenie/internal/pulumiVersion.go b/sdk/go/opsgenie/internal/pulumiVersion.go new file mode 100644 index 00000000..d5916876 --- /dev/null +++ b/sdk/go/opsgenie/internal/pulumiVersion.go @@ -0,0 +1,11 @@ +// 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 internal + +import ( + "github.com/blang/semver" +) + +var SdkVersion semver.Version = semver.Version{} +var pluginDownloadURL string = "" diff --git a/sdk/go/opsgenie/maintenance.go b/sdk/go/opsgenie/maintenance.go index 6e052bfa..52969677 100644 --- a/sdk/go/opsgenie/maintenance.go +++ b/sdk/go/opsgenie/maintenance.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -90,6 +91,7 @@ func NewMaintenance(ctx *pulumi.Context, if args.Rules == nil { return nil, errors.New("invalid value for required argument 'Rules'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource Maintenance err := ctx.RegisterResource("opsgenie:index/maintenance:Maintenance", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/notificationPolicy.go b/sdk/go/opsgenie/notificationPolicy.go index b82963c0..13a6d356 100644 --- a/sdk/go/opsgenie/notificationPolicy.go +++ b/sdk/go/opsgenie/notificationPolicy.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -62,6 +63,7 @@ func NewNotificationPolicy(ctx *pulumi.Context, if args.TeamId == nil { return nil, errors.New("invalid value for required argument 'TeamId'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource NotificationPolicy err := ctx.RegisterResource("opsgenie:index/notificationPolicy:NotificationPolicy", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/notificationRule.go b/sdk/go/opsgenie/notificationRule.go index 72319404..a589ebfd 100644 --- a/sdk/go/opsgenie/notificationRule.go +++ b/sdk/go/opsgenie/notificationRule.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -107,6 +108,7 @@ func NewNotificationRule(ctx *pulumi.Context, if args.Username == nil { return nil, errors.New("invalid value for required argument 'Username'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource NotificationRule err := ctx.RegisterResource("opsgenie:index/notificationRule:NotificationRule", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/provider.go b/sdk/go/opsgenie/provider.go index 205777c5..351e4516 100644 --- a/sdk/go/opsgenie/provider.go +++ b/sdk/go/opsgenie/provider.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -33,10 +34,11 @@ func NewProvider(ctx *pulumi.Context, return nil, errors.New("invalid value for required argument 'ApiKey'") } if args.ApiUrl == nil { - if d := getEnvOrDefault(nil, nil, "OPSGENIE_API_URL"); d != nil { + if d := internal.GetEnvOrDefault(nil, nil, "OPSGENIE_API_URL"); d != nil { args.ApiUrl = pulumi.StringPtr(d.(string)) } } + opts = internal.PkgResourceDefaultOpts(opts) var resource Provider err := ctx.RegisterResource("pulumi:providers:opsgenie", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/pulumiTypes.go b/sdk/go/opsgenie/pulumiTypes.go index 120cedcb..0d06c51b 100644 --- a/sdk/go/opsgenie/pulumiTypes.go +++ b/sdk/go/opsgenie/pulumiTypes.go @@ -7,9 +7,12 @@ import ( "context" "reflect" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) +var _ = internal.GetEnvOrDefault + type AlertPolicyFilter struct { // Conditions applied to filter. This is a block, structure is documented below. Conditions []AlertPolicyFilterCondition `pulumi:"conditions"` diff --git a/sdk/go/opsgenie/pulumiUtilities.go b/sdk/go/opsgenie/pulumiUtilities.go deleted file mode 100644 index 52086dbb..00000000 --- a/sdk/go/opsgenie/pulumiUtilities.go +++ /dev/null @@ -1,87 +0,0 @@ -// 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 opsgenie - -import ( - "fmt" - "os" - "reflect" - "regexp" - "strconv" - "strings" - - "github.com/blang/semver" - "github.com/pulumi/pulumi/sdk/v3/go/pulumi" -) - -type envParser func(v string) interface{} - -func parseEnvBool(v string) interface{} { - b, err := strconv.ParseBool(v) - if err != nil { - return nil - } - return b -} - -func parseEnvInt(v string) interface{} { - i, err := strconv.ParseInt(v, 0, 0) - if err != nil { - return nil - } - return int(i) -} - -func parseEnvFloat(v string) interface{} { - f, err := strconv.ParseFloat(v, 64) - if err != nil { - return nil - } - return f -} - -func parseEnvStringArray(v string) interface{} { - var result pulumi.StringArray - for _, item := range strings.Split(v, ";") { - result = append(result, pulumi.String(item)) - } - return result -} - -func getEnvOrDefault(def interface{}, parser envParser, vars ...string) interface{} { - for _, v := range vars { - if value, ok := os.LookupEnv(v); ok { - if parser != nil { - return parser(value) - } - return value - } - } - return def -} - -// PkgVersion uses reflection to determine the version of the current package. -// If a version cannot be determined, v1 will be assumed. The second return -// value is always nil. -func PkgVersion() (semver.Version, error) { - type sentinal struct{} - pkgPath := reflect.TypeOf(sentinal{}).PkgPath() - re := regexp.MustCompile("^.*/pulumi-opsgenie/sdk(/v\\d+)?") - if match := re.FindStringSubmatch(pkgPath); match != nil { - vStr := match[1] - if len(vStr) == 0 { // If the version capture group was empty, default to v1. - return semver.Version{Major: 1}, nil - } - return semver.MustParse(fmt.Sprintf("%s.0.0", vStr[2:])), nil - } - return semver.Version{Major: 1}, nil -} - -// isZero is a null safe check for if a value is it's types zero value. -func isZero(v interface{}) bool { - if v == nil { - return true - } - return reflect.ValueOf(v).IsZero() -} diff --git a/sdk/go/opsgenie/schedule.go b/sdk/go/opsgenie/schedule.go index 87149a16..b044b4ee 100644 --- a/sdk/go/opsgenie/schedule.go +++ b/sdk/go/opsgenie/schedule.go @@ -7,6 +7,7 @@ import ( "context" "reflect" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -72,6 +73,7 @@ func NewSchedule(ctx *pulumi.Context, args = &ScheduleArgs{} } + opts = internal.PkgResourceDefaultOpts(opts) var resource Schedule err := ctx.RegisterResource("opsgenie:index/schedule:Schedule", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/scheduleRotation.go b/sdk/go/opsgenie/scheduleRotation.go index 4e16a7ff..24937a00 100644 --- a/sdk/go/opsgenie/scheduleRotation.go +++ b/sdk/go/opsgenie/scheduleRotation.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -110,6 +111,7 @@ func NewScheduleRotation(ctx *pulumi.Context, if args.Type == nil { return nil, errors.New("invalid value for required argument 'Type'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource ScheduleRotation err := ctx.RegisterResource("opsgenie:index/scheduleRotation:ScheduleRotation", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/service.go b/sdk/go/opsgenie/service.go index d4967e4d..d43b1315 100644 --- a/sdk/go/opsgenie/service.go +++ b/sdk/go/opsgenie/service.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -75,6 +76,7 @@ func NewService(ctx *pulumi.Context, if args.TeamId == nil { return nil, errors.New("invalid value for required argument 'TeamId'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource Service err := ctx.RegisterResource("opsgenie:index/service:Service", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/serviceIncidentRule.go b/sdk/go/opsgenie/serviceIncidentRule.go index aff88293..0b56e200 100644 --- a/sdk/go/opsgenie/serviceIncidentRule.go +++ b/sdk/go/opsgenie/serviceIncidentRule.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -113,6 +114,7 @@ func NewServiceIncidentRule(ctx *pulumi.Context, if args.ServiceId == nil { return nil, errors.New("invalid value for required argument 'ServiceId'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource ServiceIncidentRule err := ctx.RegisterResource("opsgenie:index/serviceIncidentRule:ServiceIncidentRule", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/team.go b/sdk/go/opsgenie/team.go index 8a39135a..cd081fbc 100644 --- a/sdk/go/opsgenie/team.go +++ b/sdk/go/opsgenie/team.go @@ -7,6 +7,7 @@ import ( "context" "reflect" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -103,6 +104,7 @@ func NewTeam(ctx *pulumi.Context, args = &TeamArgs{} } + opts = internal.PkgResourceDefaultOpts(opts) var resource Team err := ctx.RegisterResource("opsgenie:index/team:Team", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/teamRoutingRule.go b/sdk/go/opsgenie/teamRoutingRule.go index be35947d..5e905c83 100644 --- a/sdk/go/opsgenie/teamRoutingRule.go +++ b/sdk/go/opsgenie/teamRoutingRule.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -131,6 +132,7 @@ func NewTeamRoutingRule(ctx *pulumi.Context, if args.TeamId == nil { return nil, errors.New("invalid value for required argument 'TeamId'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource TeamRoutingRule err := ctx.RegisterResource("opsgenie:index/teamRoutingRule:TeamRoutingRule", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/user.go b/sdk/go/opsgenie/user.go index be936d7b..6e948ec1 100644 --- a/sdk/go/opsgenie/user.go +++ b/sdk/go/opsgenie/user.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -109,6 +110,7 @@ func NewUser(ctx *pulumi.Context, if args.Username == nil { return nil, errors.New("invalid value for required argument 'Username'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource User err := ctx.RegisterResource("opsgenie:index/user:User", name, args, &resource, opts...) if err != nil { diff --git a/sdk/go/opsgenie/userContact.go b/sdk/go/opsgenie/userContact.go index 9dfd2a64..ee74df8b 100644 --- a/sdk/go/opsgenie/userContact.go +++ b/sdk/go/opsgenie/userContact.go @@ -8,6 +8,7 @@ import ( "reflect" "errors" + "github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie/internal" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -95,6 +96,7 @@ func NewUserContact(ctx *pulumi.Context, if args.Username == nil { return nil, errors.New("invalid value for required argument 'Username'") } + opts = internal.PkgResourceDefaultOpts(opts) var resource UserContact err := ctx.RegisterResource("opsgenie:index/userContact:UserContact", name, args, &resource, opts...) if err != nil { diff --git a/sdk/nodejs/provider.ts b/sdk/nodejs/provider.ts index f0cb361b..34398ab3 100644 --- a/sdk/nodejs/provider.ts +++ b/sdk/nodejs/provider.ts @@ -22,7 +22,7 @@ export class Provider extends pulumi.ProviderResource { if (obj === undefined || obj === null) { return false; } - return obj['__pulumiType'] === Provider.__pulumiType; + return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType; } public readonly apiKey!: pulumi.Output;