From f4d8717c719de5e1ff57fe7c70c23eb1052a5e3f Mon Sep 17 00:00:00 2001 From: pulumi-bot Date: Wed, 25 Oct 2023 02:36:14 +0000 Subject: [PATCH] make build_sdks --- sdk/dotnet/Certificate.cs | 28 +++ sdk/dotnet/Consumer.cs | 23 +++ sdk/dotnet/ConsumerAcl.cs | 39 +++++ sdk/dotnet/ConsumerBasicAuth.cs | 33 ++++ sdk/dotnet/ConsumerJwtAuth.cs | 37 ++++ sdk/dotnet/ConsumerKeyAuth.cs | 32 ++++ sdk/dotnet/ConsumerOauth2.cs | 48 ++++++ sdk/dotnet/Plugin.cs | 113 ++++++++++++ sdk/dotnet/Route.cs | 99 +++++++++++ sdk/dotnet/Service.cs | 83 +++++++++ sdk/dotnet/Target.cs | 20 +++ sdk/dotnet/Upstream.cs | 107 ++++++++++++ sdk/go/kong/certificate.go | 34 ++++ sdk/go/kong/consumer.go | 30 ++++ sdk/go/kong/consumerAcl.go | 44 +++++ sdk/go/kong/consumerBasicAuth.go | 43 +++++ sdk/go/kong/consumerJwtAuth.go | 43 +++++ sdk/go/kong/consumerKeyAuth.go | 42 +++++ sdk/go/kong/consumerOauth2.go | 57 ++++++ sdk/go/kong/plugin.go | 128 ++++++++++++++ sdk/go/kong/route.go | 101 +++++++++++ sdk/go/kong/service.go | 86 ++++++++++ sdk/go/kong/target.go | 28 +++ sdk/go/kong/upstream.go | 97 +++++++++++ sdk/nodejs/certificate.ts | 17 ++ sdk/nodejs/consumer.ts | 13 ++ sdk/nodejs/consumerAcl.ts | 25 +++ sdk/nodejs/consumerBasicAuth.ts | 22 +++ sdk/nodejs/consumerJwtAuth.ts | 24 +++ sdk/nodejs/consumerKeyAuth.ts | 21 +++ sdk/nodejs/consumerOauth2.ts | 31 ++++ sdk/nodejs/plugin.ts | 77 +++++++++ sdk/nodejs/route.ts | 59 +++++++ sdk/nodejs/service.ts | 56 ++++++ sdk/nodejs/target.ts | 13 ++ sdk/nodejs/upstream.ts | 83 +++++++++ sdk/python/pulumi_kong/certificate.py | 32 ++++ sdk/python/pulumi_kong/consumer.py | 24 +++ sdk/python/pulumi_kong/consumer_acl.py | 46 +++++ sdk/python/pulumi_kong/consumer_basic_auth.py | 40 +++++ sdk/python/pulumi_kong/consumer_jwt_auth.py | 44 +++++ sdk/python/pulumi_kong/consumer_key_auth.py | 38 ++++ sdk/python/pulumi_kong/consumer_oauth2.py | 58 +++++++ sdk/python/pulumi_kong/plugin.py | 142 +++++++++++++++ sdk/python/pulumi_kong/route.py | 114 ++++++++++++ sdk/python/pulumi_kong/service.py | 104 +++++++++++ sdk/python/pulumi_kong/target.py | 24 +++ sdk/python/pulumi_kong/upstream.py | 162 ++++++++++++++++++ 48 files changed, 2664 insertions(+) diff --git a/sdk/dotnet/Certificate.cs b/sdk/dotnet/Certificate.cs index b57bf47f..88d18ea1 100644 --- a/sdk/dotnet/Certificate.cs +++ b/sdk/dotnet/Certificate.cs @@ -14,6 +14,34 @@ namespace Pulumi.Kong /// /// For more information on creating certificates in Kong [see their documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#certificate-object) /// + /// ## Example Usage + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var certificate = new Kong.Certificate("certificate", new() + /// { + /// Cert = "public key --- 123 ----", + /// PrivateKey = "private key --- 456 ----", + /// Snis = new[] + /// { + /// "foo.com", + /// "bar.com", + /// }, + /// Tags = new[] + /// { + /// "myTag", + /// }, + /// }); + /// + /// }); + /// ``` + /// /// ## Import /// /// To import a certificate diff --git a/sdk/dotnet/Consumer.cs b/sdk/dotnet/Consumer.cs index 0b469005..bb256fa9 100644 --- a/sdk/dotnet/Consumer.cs +++ b/sdk/dotnet/Consumer.cs @@ -14,6 +14,29 @@ namespace Pulumi.Kong /// /// The consumer resource maps directly onto the json for creating a Consumer in Kong. For more information on the parameters [see the Kong Consumer create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#consumer-object). /// + /// ## Example Usage + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var consumer = new Kong.Consumer("consumer", new() + /// { + /// CustomId = "123", + /// Tags = new[] + /// { + /// "mySuperTag", + /// }, + /// Username = "User1", + /// }); + /// + /// }); + /// ``` + /// /// ## Import /// /// To import a consumer diff --git a/sdk/dotnet/ConsumerAcl.cs b/sdk/dotnet/ConsumerAcl.cs index 5db9071e..7bf1ceee 100644 --- a/sdk/dotnet/ConsumerAcl.cs +++ b/sdk/dotnet/ConsumerAcl.cs @@ -13,6 +13,45 @@ namespace Pulumi.Kong /// ## # kong.ConsumerAcl /// /// Consumer ACL is a resource that allows you to configure the acl plugin for a consumer. + /// + /// ## Example Usage + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var myConsumer = new Kong.Consumer("myConsumer", new() + /// { + /// CustomId = "123", + /// Username = "User1", + /// }); + /// + /// var aclPlugin = new Kong.Plugin("aclPlugin", new() + /// { + /// ConfigJson = @" { + /// ""allow"": [""group1"", ""group2""] + /// } + /// + /// ", + /// }); + /// + /// var consumerAcl = new Kong.ConsumerAcl("consumerAcl", new() + /// { + /// ConsumerId = myConsumer.Id, + /// Group = "group2", + /// Tags = new[] + /// { + /// "myTag", + /// "otherTag", + /// }, + /// }); + /// + /// }); + /// ``` /// [KongResourceType("kong:index/consumerAcl:ConsumerAcl")] public partial class ConsumerAcl : global::Pulumi.CustomResource diff --git a/sdk/dotnet/ConsumerBasicAuth.cs b/sdk/dotnet/ConsumerBasicAuth.cs index 9196ddad..abc77e5b 100644 --- a/sdk/dotnet/ConsumerBasicAuth.cs +++ b/sdk/dotnet/ConsumerBasicAuth.cs @@ -13,6 +13,39 @@ namespace Pulumi.Kong /// ## # kong.ConsumerBasicAuth /// /// Consumer basic auth is a resource that allows you to configure the basic auth plugin for a consumer. + /// + /// ## Example Usage + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var myConsumer = new Kong.Consumer("myConsumer", new() + /// { + /// CustomId = "123", + /// Username = "User1", + /// }); + /// + /// var basicAuthPlugin = new Kong.Plugin("basicAuthPlugin"); + /// + /// var consumerBasicAuth = new Kong.ConsumerBasicAuth("consumerBasicAuth", new() + /// { + /// ConsumerId = myConsumer.Id, + /// Password = "bar_updated", + /// Tags = new[] + /// { + /// "myTag", + /// "anotherTag", + /// }, + /// Username = "foo_updated", + /// }); + /// + /// }); + /// ``` /// [KongResourceType("kong:index/consumerBasicAuth:ConsumerBasicAuth")] public partial class ConsumerBasicAuth : global::Pulumi.CustomResource diff --git a/sdk/dotnet/ConsumerJwtAuth.cs b/sdk/dotnet/ConsumerJwtAuth.cs index 2edc9ef6..fd7fdf53 100644 --- a/sdk/dotnet/ConsumerJwtAuth.cs +++ b/sdk/dotnet/ConsumerJwtAuth.cs @@ -13,6 +13,43 @@ namespace Pulumi.Kong /// ## # kong.ConsumerJwtAuth /// /// Consumer jwt auth is a resource that allows you to configure the jwt auth plugin for a consumer. + /// + /// ## Example Usage + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var myConsumer = new Kong.Consumer("myConsumer", new() + /// { + /// CustomId = "123", + /// Username = "User1", + /// }); + /// + /// var jwtPlugin = new Kong.Plugin("jwtPlugin", new() + /// { + /// ConfigJson = @" { + /// ""claims_to_verify"": [""exp""] + /// } + /// + /// ", + /// }); + /// + /// var consumerJwtConfig = new Kong.ConsumerJwtAuth("consumerJwtConfig", new() + /// { + /// Algorithm = "HS256", + /// ConsumerId = myConsumer.Id, + /// Key = "my_key", + /// RsaPublicKey = "foo", + /// Secret = "my_secret", + /// }); + /// + /// }); + /// ``` /// [KongResourceType("kong:index/consumerJwtAuth:ConsumerJwtAuth")] public partial class ConsumerJwtAuth : global::Pulumi.CustomResource diff --git a/sdk/dotnet/ConsumerKeyAuth.cs b/sdk/dotnet/ConsumerKeyAuth.cs index 727d1901..05d59fdf 100644 --- a/sdk/dotnet/ConsumerKeyAuth.cs +++ b/sdk/dotnet/ConsumerKeyAuth.cs @@ -13,6 +13,38 @@ namespace Pulumi.Kong /// ## # kong.ConsumerKeyAuth /// /// Resource that allows you to configure the [Key Authentication](https://docs.konghq.com/hub/kong-inc/key-auth/) plugin for a consumer. + /// + /// ## Example Usage + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var myConsumer = new Kong.Consumer("myConsumer", new() + /// { + /// Username = "User1", + /// CustomId = "123", + /// }); + /// + /// var keyAuthPlugin = new Kong.Plugin("keyAuthPlugin"); + /// + /// var consumerKeyAuth = new Kong.ConsumerKeyAuth("consumerKeyAuth", new() + /// { + /// ConsumerId = myConsumer.Id, + /// Key = "secret", + /// Tags = new[] + /// { + /// "myTag", + /// "anotherTag", + /// }, + /// }); + /// + /// }); + /// ``` /// [KongResourceType("kong:index/consumerKeyAuth:ConsumerKeyAuth")] public partial class ConsumerKeyAuth : global::Pulumi.CustomResource diff --git a/sdk/dotnet/ConsumerOauth2.cs b/sdk/dotnet/ConsumerOauth2.cs index a2748f66..b52aa5b4 100644 --- a/sdk/dotnet/ConsumerOauth2.cs +++ b/sdk/dotnet/ConsumerOauth2.cs @@ -13,6 +13,54 @@ namespace Pulumi.Kong /// ## # kong.ConsumerOauth2 /// /// Resource that allows you to configure the OAuth2 plugin credentials for a consumer. + /// + /// ## Example Usage + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var myConsumer = new Kong.Consumer("myConsumer", new() + /// { + /// CustomId = "123", + /// Username = "User1", + /// }); + /// + /// var oauth2Plugin = new Kong.Plugin("oauth2Plugin", new() + /// { + /// ConfigJson = @" { + /// ""global_credentials"": true, + /// ""enable_password_grant"": true, + /// ""token_expiration"": 180, + /// ""refresh_token_ttl"": 180, + /// ""provision_key"": ""testprovisionkey"" + /// } + /// + /// ", + /// }); + /// + /// var consumerOauth2 = new Kong.ConsumerOauth2("consumerOauth2", new() + /// { + /// ClientId = "client_id", + /// ClientSecret = "client_secret", + /// ConsumerId = myConsumer.Id, + /// RedirectUris = new[] + /// { + /// "https://asdf.com/callback", + /// "https://test.cl/callback", + /// }, + /// Tags = new[] + /// { + /// "myTag", + /// }, + /// }); + /// + /// }); + /// ``` /// [KongResourceType("kong:index/consumerOauth2:ConsumerOauth2")] public partial class ConsumerOauth2 : global::Pulumi.CustomResource diff --git a/sdk/dotnet/Plugin.cs b/sdk/dotnet/Plugin.cs index d202f573..a89ac36f 100644 --- a/sdk/dotnet/Plugin.cs +++ b/sdk/dotnet/Plugin.cs @@ -15,6 +15,119 @@ namespace Pulumi.Kong /// The plugin resource maps directly onto the json for the API endpoint in Kong. For more information on the parameters [see the Kong Api create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#plugin-object). /// The `config_json` is passed through to the plugin to configure it as is. /// + /// ## Example Usage + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var rateLimit = new Kong.Plugin("rateLimit", new() + /// { + /// ConfigJson = @" { + /// ""second"": 5, + /// ""hour"" : 1000 + /// } + /// + /// ", + /// }); + /// + /// }); + /// ``` + /// To apply a plugin to a consumer use the `consumer_id` property, for example: + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var pluginConsumer = new Kong.Consumer("pluginConsumer", new() + /// { + /// CustomId = "567", + /// Username = "PluginUser", + /// }); + /// + /// var rateLimit = new Kong.Plugin("rateLimit", new() + /// { + /// ConfigJson = @" { + /// ""second"": 5, + /// ""hour"" : 1000 + /// } + /// + /// ", + /// ConsumerId = pluginConsumer.Id, + /// }); + /// + /// }); + /// ``` + /// + /// To apply a plugin to a service use the `service_id` property, for example: + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var service = new Kong.Service("service", new() + /// { + /// Host = "test.org", + /// Protocol = "http", + /// }); + /// + /// var rateLimit = new Kong.Plugin("rateLimit", new() + /// { + /// ConfigJson = @" { + /// ""second"": 10, + /// ""hour"" : 2000 + /// } + /// + /// ", + /// ServiceId = service.Id, + /// }); + /// + /// }); + /// ``` + /// + /// To apply a plugin to a route use the `route_id` property, for example: + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var service = new Kong.Service("service", new() + /// { + /// Host = "test.org", + /// Protocol = "http", + /// }); + /// + /// var rateLimit = new Kong.Plugin("rateLimit", new() + /// { + /// ConfigJson = @" { + /// ""second"": 11, + /// ""hour"" : 4000 + /// } + /// + /// ", + /// Enabled = true, + /// ServiceId = service.Id, + /// }); + /// + /// }); + /// ``` + /// /// ## Import /// /// To import a plugin diff --git a/sdk/dotnet/Route.cs b/sdk/dotnet/Route.cs index 97410f3e..1b8c0f6c 100644 --- a/sdk/dotnet/Route.cs +++ b/sdk/dotnet/Route.cs @@ -16,6 +16,105 @@ namespace Pulumi.Kong /// /// To create a tcp/tls route you set `sources` and `destinations` by repeating the corresponding element (`source` or `destination`) for each source or destination you want. /// + /// ## Example Usage + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var route = new Kong.Route("route", new() + /// { + /// Protocols = new[] + /// { + /// "http", + /// "https", + /// }, + /// Methods = new[] + /// { + /// "GET", + /// "POST", + /// }, + /// Hosts = new[] + /// { + /// "example2.com", + /// }, + /// Paths = new[] + /// { + /// "/test", + /// }, + /// StripPath = false, + /// PreserveHost = true, + /// RegexPriority = 1, + /// ServiceId = kong_service.Service.Id, + /// Headers = new[] + /// { + /// new Kong.Inputs.RouteHeaderArgs + /// { + /// Name = "x-test-1", + /// Values = new[] + /// { + /// "a", + /// "b", + /// }, + /// }, + /// }, + /// }); + /// + /// }); + /// ``` + /// + /// To create a tcp/tls route you set `sources` and `destinations` by repeating the corresponding element (`source` or `destination`) for each source or destination you want, for example: + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var route = new Kong.Route("route", new() + /// { + /// Protocols = new[] + /// { + /// "tcp", + /// }, + /// StripPath = true, + /// PreserveHost = false, + /// Sources = new[] + /// { + /// new Kong.Inputs.RouteSourceArgs + /// { + /// Ip = "192.168.1.1", + /// Port = 80, + /// }, + /// new Kong.Inputs.RouteSourceArgs + /// { + /// Ip = "192.168.1.2", + /// }, + /// }, + /// Destinations = new[] + /// { + /// new Kong.Inputs.RouteDestinationArgs + /// { + /// Ip = "172.10.1.1", + /// Port = 81, + /// }, + /// }, + /// Snis = new[] + /// { + /// "foo.com", + /// }, + /// ServiceId = kong_service.Service.Id, + /// }); + /// + /// }); + /// ``` + /// /// ## Import /// /// To import a route diff --git a/sdk/dotnet/Service.cs b/sdk/dotnet/Service.cs index 7b9e5ad8..5343e373 100644 --- a/sdk/dotnet/Service.cs +++ b/sdk/dotnet/Service.cs @@ -14,6 +14,89 @@ namespace Pulumi.Kong /// /// The service resource maps directly onto the json for the service endpoint in Kong. For more information on the parameters [see the Kong Service create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#service-object). /// + /// ## Example Usage + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var service = new Kong.Service("service", new() + /// { + /// ConnectTimeout = 1000, + /// Host = "test.org", + /// Path = "/mypath", + /// Port = 8080, + /// Protocol = "http", + /// ReadTimeout = 3000, + /// Retries = 5, + /// WriteTimeout = 2000, + /// }); + /// + /// }); + /// ``` + /// + /// To use a client certificate and ca certificates combine with certificate resource (note protocol must be `https`): + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var certificate = new Kong.Certificate("certificate", new() + /// { + /// Cert = @" -----BEGIN CERTIFICATE----- + /// ...... + /// -----END CERTIFICATE----- + /// ", + /// PrivateKey = @" -----BEGIN PRIVATE KEY----- + /// ..... + /// -----END PRIVATE KEY----- + /// ", + /// Snis = new[] + /// { + /// "foo.com", + /// }, + /// }); + /// + /// var ca = new Kong.Certificate("ca", new() + /// { + /// Cert = @" -----BEGIN CERTIFICATE----- + /// ...... + /// -----END CERTIFICATE----- + /// ", + /// PrivateKey = @" -----BEGIN PRIVATE KEY----- + /// ..... + /// -----END PRIVATE KEY----- + /// ", + /// Snis = new[] + /// { + /// "ca.com", + /// }, + /// }); + /// + /// var service = new Kong.Service("service", new() + /// { + /// Protocol = "https", + /// Host = "test.org", + /// TlsVerify = true, + /// TlsVerifyDepth = 2, + /// ClientCertificateId = certificate.Id, + /// CaCertificateIds = new[] + /// { + /// ca.Id, + /// }, + /// }); + /// + /// }); + /// ``` + /// /// ## Import /// /// To import a service diff --git a/sdk/dotnet/Target.cs b/sdk/dotnet/Target.cs index 6152d864..2893f299 100644 --- a/sdk/dotnet/Target.cs +++ b/sdk/dotnet/Target.cs @@ -10,6 +10,26 @@ namespace Pulumi.Kong { /// + /// ## Example Usage + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var target = new Kong.Target("target", new() + /// { + /// TargetAddress = "sample_target:80", + /// UpstreamId = kong_upstream.Upstream.Id, + /// Weight = 10, + /// }); + /// + /// }); + /// ``` + /// /// ## Import /// /// To import a target use a combination of the upstream id and the target id as follows diff --git a/sdk/dotnet/Upstream.cs b/sdk/dotnet/Upstream.cs index acb79978..5db64616 100644 --- a/sdk/dotnet/Upstream.cs +++ b/sdk/dotnet/Upstream.cs @@ -10,6 +10,113 @@ namespace Pulumi.Kong { /// + /// ## Example Usage + /// + /// ```csharp + /// using System.Collections.Generic; + /// using System.Linq; + /// using Pulumi; + /// using Kong = Pulumi.Kong; + /// + /// return await Deployment.RunAsync(() => + /// { + /// var certificate = new Kong.Certificate("certificate", new() + /// { + /// Cert = @" -----BEGIN CERTIFICATE----- + /// ...... + /// -----END CERTIFICATE----- + /// ", + /// PrivateKey = @" -----BEGIN PRIVATE KEY----- + /// ..... + /// -----END PRIVATE KEY----- + /// ", + /// Snis = new[] + /// { + /// "foo.com", + /// }, + /// }); + /// + /// var upstream = new Kong.Upstream("upstream", new() + /// { + /// Slots = 10, + /// HashOn = "header", + /// HashFallback = "cookie", + /// HashOnHeader = "HeaderName", + /// HashFallbackHeader = "FallbackHeaderName", + /// HashOnCookie = "CookieName", + /// HashOnCookiePath = "/path", + /// HostHeader = "x-host", + /// Tags = new[] + /// { + /// "a", + /// "b", + /// }, + /// ClientCertificateId = certificate.Id, + /// Healthchecks = new Kong.Inputs.UpstreamHealthchecksArgs + /// { + /// Active = new Kong.Inputs.UpstreamHealthchecksActiveArgs + /// { + /// Type = "https", + /// HttpPath = "/status", + /// Timeout = 10, + /// Concurrency = 20, + /// HttpsVerifyCertificate = false, + /// HttpsSni = "some.domain.com", + /// Healthy = new Kong.Inputs.UpstreamHealthchecksActiveHealthyArgs + /// { + /// Successes = 1, + /// Interval = 5, + /// HttpStatuses = new[] + /// { + /// 200, + /// 201, + /// }, + /// }, + /// Unhealthy = new Kong.Inputs.UpstreamHealthchecksActiveUnhealthyArgs + /// { + /// Timeouts = 7, + /// Interval = 3, + /// TcpFailures = 1, + /// HttpFailures = 2, + /// HttpStatuses = new[] + /// { + /// 500, + /// 501, + /// }, + /// }, + /// }, + /// Passive = new Kong.Inputs.UpstreamHealthchecksPassiveArgs + /// { + /// Type = "https", + /// Healthy = new Kong.Inputs.UpstreamHealthchecksPassiveHealthyArgs + /// { + /// Successes = 1, + /// HttpStatuses = new[] + /// { + /// 200, + /// 201, + /// 202, + /// }, + /// }, + /// Unhealthy = new Kong.Inputs.UpstreamHealthchecksPassiveUnhealthyArgs + /// { + /// Timeouts = 3, + /// TcpFailures = 5, + /// HttpFailures = 6, + /// HttpStatuses = new[] + /// { + /// 500, + /// 501, + /// 502, + /// }, + /// }, + /// }, + /// }, + /// }); + /// + /// }); + /// ``` + /// /// ## Import /// /// To import an upstream diff --git a/sdk/go/kong/certificate.go b/sdk/go/kong/certificate.go index e218cdeb..4cf3dcb6 100644 --- a/sdk/go/kong/certificate.go +++ b/sdk/go/kong/certificate.go @@ -17,6 +17,40 @@ import ( // // For more information on creating certificates in Kong [see their documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#certificate-object) // +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := kong.NewCertificate(ctx, "certificate", &kong.CertificateArgs{ +// Certificate: pulumi.String("public key --- 123 ----"), +// PrivateKey: pulumi.String("private key --- 456 ----"), +// Snis: pulumi.StringArray{ +// pulumi.String("foo.com"), +// pulumi.String("bar.com"), +// }, +// Tags: pulumi.StringArray{ +// pulumi.String("myTag"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// // ## Import // // # To import a certificate diff --git a/sdk/go/kong/consumer.go b/sdk/go/kong/consumer.go index 7bf0f984..a8149822 100644 --- a/sdk/go/kong/consumer.go +++ b/sdk/go/kong/consumer.go @@ -16,6 +16,36 @@ import ( // // The consumer resource maps directly onto the json for creating a Consumer in Kong. For more information on the parameters [see the Kong Consumer create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#consumer-object). // +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := kong.NewConsumer(ctx, "consumer", &kong.ConsumerArgs{ +// CustomId: pulumi.String("123"), +// Tags: pulumi.StringArray{ +// pulumi.String("mySuperTag"), +// }, +// Username: pulumi.String("User1"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// // ## Import // // # To import a consumer diff --git a/sdk/go/kong/consumerAcl.go b/sdk/go/kong/consumerAcl.go index 392cc852..19012ef4 100644 --- a/sdk/go/kong/consumerAcl.go +++ b/sdk/go/kong/consumerAcl.go @@ -16,6 +16,50 @@ import ( // ## # ConsumerAcl // // Consumer ACL is a resource that allows you to configure the acl plugin for a consumer. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// myConsumer, err := kong.NewConsumer(ctx, "myConsumer", &kong.ConsumerArgs{ +// CustomId: pulumi.String("123"), +// Username: pulumi.String("User1"), +// }) +// if err != nil { +// return err +// } +// _, err = kong.NewPlugin(ctx, "aclPlugin", &kong.PluginArgs{ +// ConfigJson: pulumi.String(" {\n \"allow\": [\"group1\", \"group2\"]\n }\n\n"), +// }) +// if err != nil { +// return err +// } +// _, err = kong.NewConsumerAcl(ctx, "consumerAcl", &kong.ConsumerAclArgs{ +// ConsumerId: myConsumer.ID(), +// Group: pulumi.String("group2"), +// Tags: pulumi.StringArray{ +// pulumi.String("myTag"), +// pulumi.String("otherTag"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` type ConsumerAcl struct { pulumi.CustomResourceState diff --git a/sdk/go/kong/consumerBasicAuth.go b/sdk/go/kong/consumerBasicAuth.go index 9b7c1ff2..51415534 100644 --- a/sdk/go/kong/consumerBasicAuth.go +++ b/sdk/go/kong/consumerBasicAuth.go @@ -16,6 +16,49 @@ import ( // ## # ConsumerBasicAuth // // Consumer basic auth is a resource that allows you to configure the basic auth plugin for a consumer. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// myConsumer, err := kong.NewConsumer(ctx, "myConsumer", &kong.ConsumerArgs{ +// CustomId: pulumi.String("123"), +// Username: pulumi.String("User1"), +// }) +// if err != nil { +// return err +// } +// _, err = kong.NewPlugin(ctx, "basicAuthPlugin", nil) +// if err != nil { +// return err +// } +// _, err = kong.NewConsumerBasicAuth(ctx, "consumerBasicAuth", &kong.ConsumerBasicAuthArgs{ +// ConsumerId: myConsumer.ID(), +// Password: pulumi.String("bar_updated"), +// Tags: pulumi.StringArray{ +// pulumi.String("myTag"), +// pulumi.String("anotherTag"), +// }, +// Username: pulumi.String("foo_updated"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` type ConsumerBasicAuth struct { pulumi.CustomResourceState diff --git a/sdk/go/kong/consumerJwtAuth.go b/sdk/go/kong/consumerJwtAuth.go index b14d224c..e38255e4 100644 --- a/sdk/go/kong/consumerJwtAuth.go +++ b/sdk/go/kong/consumerJwtAuth.go @@ -16,6 +16,49 @@ import ( // ## # ConsumerJwtAuth // // Consumer jwt auth is a resource that allows you to configure the jwt auth plugin for a consumer. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// myConsumer, err := kong.NewConsumer(ctx, "myConsumer", &kong.ConsumerArgs{ +// CustomId: pulumi.String("123"), +// Username: pulumi.String("User1"), +// }) +// if err != nil { +// return err +// } +// _, err = kong.NewPlugin(ctx, "jwtPlugin", &kong.PluginArgs{ +// ConfigJson: pulumi.String(" {\n \"claims_to_verify\": [\"exp\"]\n }\n\n"), +// }) +// if err != nil { +// return err +// } +// _, err = kong.NewConsumerJwtAuth(ctx, "consumerJwtConfig", &kong.ConsumerJwtAuthArgs{ +// Algorithm: pulumi.String("HS256"), +// ConsumerId: myConsumer.ID(), +// Key: pulumi.String("my_key"), +// RsaPublicKey: pulumi.String("foo"), +// Secret: pulumi.String("my_secret"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` type ConsumerJwtAuth struct { pulumi.CustomResourceState diff --git a/sdk/go/kong/consumerKeyAuth.go b/sdk/go/kong/consumerKeyAuth.go index ab973c69..6e25212d 100644 --- a/sdk/go/kong/consumerKeyAuth.go +++ b/sdk/go/kong/consumerKeyAuth.go @@ -16,6 +16,48 @@ import ( // ## # ConsumerKeyAuth // // Resource that allows you to configure the [Key Authentication](https://docs.konghq.com/hub/kong-inc/key-auth/) plugin for a consumer. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// myConsumer, err := kong.NewConsumer(ctx, "myConsumer", &kong.ConsumerArgs{ +// Username: pulumi.String("User1"), +// CustomId: pulumi.String("123"), +// }) +// if err != nil { +// return err +// } +// _, err = kong.NewPlugin(ctx, "keyAuthPlugin", nil) +// if err != nil { +// return err +// } +// _, err = kong.NewConsumerKeyAuth(ctx, "consumerKeyAuth", &kong.ConsumerKeyAuthArgs{ +// ConsumerId: myConsumer.ID(), +// Key: pulumi.String("secret"), +// Tags: pulumi.StringArray{ +// pulumi.String("myTag"), +// pulumi.String("anotherTag"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` type ConsumerKeyAuth struct { pulumi.CustomResourceState diff --git a/sdk/go/kong/consumerOauth2.go b/sdk/go/kong/consumerOauth2.go index 77ed0477..5d22876b 100644 --- a/sdk/go/kong/consumerOauth2.go +++ b/sdk/go/kong/consumerOauth2.go @@ -16,6 +16,63 @@ import ( // ## # ConsumerOauth2 // // Resource that allows you to configure the OAuth2 plugin credentials for a consumer. +// +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// myConsumer, err := kong.NewConsumer(ctx, "myConsumer", &kong.ConsumerArgs{ +// CustomId: pulumi.String("123"), +// Username: pulumi.String("User1"), +// }) +// if err != nil { +// return err +// } +// _, err = kong.NewPlugin(ctx, "oauth2Plugin", &kong.PluginArgs{ +// ConfigJson: pulumi.String(` { +// "global_credentials": true, +// "enable_password_grant": true, +// "token_expiration": 180, +// "refresh_token_ttl": 180, +// "provision_key": "testprovisionkey" +// } +// +// `), +// +// }) +// if err != nil { +// return err +// } +// _, err = kong.NewConsumerOauth2(ctx, "consumerOauth2", &kong.ConsumerOauth2Args{ +// ClientId: pulumi.String("client_id"), +// ClientSecret: pulumi.String("client_secret"), +// ConsumerId: myConsumer.ID(), +// RedirectUris: pulumi.StringArray{ +// pulumi.String("https://asdf.com/callback"), +// pulumi.String("https://test.cl/callback"), +// }, +// Tags: pulumi.StringArray{ +// pulumi.String("myTag"), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` type ConsumerOauth2 struct { pulumi.CustomResourceState diff --git a/sdk/go/kong/plugin.go b/sdk/go/kong/plugin.go index 1baedeb7..8f573221 100644 --- a/sdk/go/kong/plugin.go +++ b/sdk/go/kong/plugin.go @@ -17,6 +17,134 @@ import ( // The plugin resource maps directly onto the json for the API endpoint in Kong. For more information on the parameters [see the Kong Api create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#plugin-object). // The `configJson` is passed through to the plugin to configure it as is. // +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := kong.NewPlugin(ctx, "rateLimit", &kong.PluginArgs{ +// ConfigJson: pulumi.String(" {\n \"second\": 5,\n \"hour\" : 1000\n }\n\n"), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// To apply a plugin to a consumer use the `consumerId` property, for example: +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// pluginConsumer, err := kong.NewConsumer(ctx, "pluginConsumer", &kong.ConsumerArgs{ +// CustomId: pulumi.String("567"), +// Username: pulumi.String("PluginUser"), +// }) +// if err != nil { +// return err +// } +// _, err = kong.NewPlugin(ctx, "rateLimit", &kong.PluginArgs{ +// ConfigJson: pulumi.String(" {\n \"second\": 5,\n \"hour\" : 1000\n }\n\n"), +// ConsumerId: pluginConsumer.ID(), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// To apply a plugin to a service use the `serviceId` property, for example: +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// service, err := kong.NewService(ctx, "service", &kong.ServiceArgs{ +// Host: pulumi.String("test.org"), +// Protocol: pulumi.String("http"), +// }) +// if err != nil { +// return err +// } +// _, err = kong.NewPlugin(ctx, "rateLimit", &kong.PluginArgs{ +// ConfigJson: pulumi.String(" {\n \"second\": 10,\n \"hour\" : 2000\n }\n\n"), +// ServiceId: service.ID(), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// To apply a plugin to a route use the `routeId` property, for example: +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// service, err := kong.NewService(ctx, "service", &kong.ServiceArgs{ +// Host: pulumi.String("test.org"), +// Protocol: pulumi.String("http"), +// }) +// if err != nil { +// return err +// } +// _, err = kong.NewPlugin(ctx, "rateLimit", &kong.PluginArgs{ +// ConfigJson: pulumi.String(" {\n \"second\": 11,\n \"hour\" : 4000\n }\n\n"), +// Enabled: pulumi.Bool(true), +// ServiceId: service.ID(), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// // ## Import // // # To import a plugin diff --git a/sdk/go/kong/route.go b/sdk/go/kong/route.go index 33fe3df4..823e2eff 100644 --- a/sdk/go/kong/route.go +++ b/sdk/go/kong/route.go @@ -19,6 +19,107 @@ import ( // // To create a tcp/tls route you set `sources` and `destinations` by repeating the corresponding element (`source` or `destination`) for each source or destination you want. // +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := kong.NewRoute(ctx, "route", &kong.RouteArgs{ +// Protocols: pulumi.StringArray{ +// pulumi.String("http"), +// pulumi.String("https"), +// }, +// Methods: pulumi.StringArray{ +// pulumi.String("GET"), +// pulumi.String("POST"), +// }, +// Hosts: pulumi.StringArray{ +// pulumi.String("example2.com"), +// }, +// Paths: pulumi.StringArray{ +// pulumi.String("/test"), +// }, +// StripPath: pulumi.Bool(false), +// PreserveHost: pulumi.Bool(true), +// RegexPriority: pulumi.Int(1), +// ServiceId: pulumi.Any(kong_service.Service.Id), +// Headers: kong.RouteHeaderArray{ +// &kong.RouteHeaderArgs{ +// Name: pulumi.String("x-test-1"), +// Values: pulumi.StringArray{ +// pulumi.String("a"), +// pulumi.String("b"), +// }, +// }, +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// To create a tcp/tls route you set `sources` and `destinations` by repeating the corresponding element (`source` or `destination`) for each source or destination you want, for example: +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := kong.NewRoute(ctx, "route", &kong.RouteArgs{ +// Protocols: pulumi.StringArray{ +// pulumi.String("tcp"), +// }, +// StripPath: pulumi.Bool(true), +// PreserveHost: pulumi.Bool(false), +// Sources: kong.RouteSourceArray{ +// &kong.RouteSourceArgs{ +// Ip: pulumi.String("192.168.1.1"), +// Port: pulumi.Int(80), +// }, +// &kong.RouteSourceArgs{ +// Ip: pulumi.String("192.168.1.2"), +// }, +// }, +// Destinations: kong.RouteDestinationArray{ +// &kong.RouteDestinationArgs{ +// Ip: pulumi.String("172.10.1.1"), +// Port: pulumi.Int(81), +// }, +// }, +// Snis: pulumi.StringArray{ +// pulumi.String("foo.com"), +// }, +// ServiceId: pulumi.Any(kong_service.Service.Id), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// // ## Import // // # To import a route diff --git a/sdk/go/kong/service.go b/sdk/go/kong/service.go index df18aa23..9f5ee759 100644 --- a/sdk/go/kong/service.go +++ b/sdk/go/kong/service.go @@ -17,6 +17,92 @@ import ( // // The service resource maps directly onto the json for the service endpoint in Kong. For more information on the parameters [see the Kong Service create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#service-object). // +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := kong.NewService(ctx, "service", &kong.ServiceArgs{ +// ConnectTimeout: pulumi.Int(1000), +// Host: pulumi.String("test.org"), +// Path: pulumi.String("/mypath"), +// Port: pulumi.Int(8080), +// Protocol: pulumi.String("http"), +// ReadTimeout: pulumi.Int(3000), +// Retries: pulumi.Int(5), +// WriteTimeout: pulumi.Int(2000), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// +// To use a client certificate and ca certificates combine with certificate resource (note protocol must be `https`): +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// certificate, err := kong.NewCertificate(ctx, "certificate", &kong.CertificateArgs{ +// Certificate: pulumi.String(" -----BEGIN CERTIFICATE-----\n ......\n -----END CERTIFICATE-----\n"), +// PrivateKey: pulumi.String(" -----BEGIN PRIVATE KEY-----\n .....\n -----END PRIVATE KEY-----\n"), +// Snis: pulumi.StringArray{ +// pulumi.String("foo.com"), +// }, +// }) +// if err != nil { +// return err +// } +// ca, err := kong.NewCertificate(ctx, "ca", &kong.CertificateArgs{ +// Certificate: pulumi.String(" -----BEGIN CERTIFICATE-----\n ......\n -----END CERTIFICATE-----\n"), +// PrivateKey: pulumi.String(" -----BEGIN PRIVATE KEY-----\n .....\n -----END PRIVATE KEY-----\n"), +// Snis: pulumi.StringArray{ +// pulumi.String("ca.com"), +// }, +// }) +// if err != nil { +// return err +// } +// _, err = kong.NewService(ctx, "service", &kong.ServiceArgs{ +// Protocol: pulumi.String("https"), +// Host: pulumi.String("test.org"), +// TlsVerify: pulumi.Bool(true), +// TlsVerifyDepth: pulumi.Int(2), +// ClientCertificateId: certificate.ID(), +// CaCertificateIds: pulumi.StringArray{ +// ca.ID(), +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// // ## Import // // # To import a service diff --git a/sdk/go/kong/target.go b/sdk/go/kong/target.go index 698511cf..e156093a 100644 --- a/sdk/go/kong/target.go +++ b/sdk/go/kong/target.go @@ -13,6 +13,34 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/pulumix" ) +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// _, err := kong.NewTarget(ctx, "target", &kong.TargetArgs{ +// Target: pulumi.String("sample_target:80"), +// UpstreamId: pulumi.Any(kong_upstream.Upstream.Id), +// Weight: pulumi.Int(10), +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// // ## Import // // # To import a target use a combination of the upstream id and the target id as follows diff --git a/sdk/go/kong/upstream.go b/sdk/go/kong/upstream.go index 24141ef5..aa2265ea 100644 --- a/sdk/go/kong/upstream.go +++ b/sdk/go/kong/upstream.go @@ -12,6 +12,103 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/pulumix" ) +// ## Example Usage +// +// ```go +// package main +// +// import ( +// +// "github.com/pulumi/pulumi-kong/sdk/v4/go/kong" +// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +// +// ) +// +// func main() { +// pulumi.Run(func(ctx *pulumi.Context) error { +// certificate, err := kong.NewCertificate(ctx, "certificate", &kong.CertificateArgs{ +// Certificate: pulumi.String(" -----BEGIN CERTIFICATE-----\n ......\n -----END CERTIFICATE-----\n"), +// PrivateKey: pulumi.String(" -----BEGIN PRIVATE KEY-----\n .....\n -----END PRIVATE KEY-----\n"), +// Snis: pulumi.StringArray{ +// pulumi.String("foo.com"), +// }, +// }) +// if err != nil { +// return err +// } +// _, err = kong.NewUpstream(ctx, "upstream", &kong.UpstreamArgs{ +// Slots: pulumi.Int(10), +// HashOn: pulumi.String("header"), +// HashFallback: pulumi.String("cookie"), +// HashOnHeader: pulumi.String("HeaderName"), +// HashFallbackHeader: pulumi.String("FallbackHeaderName"), +// HashOnCookie: pulumi.String("CookieName"), +// HashOnCookiePath: pulumi.String("/path"), +// HostHeader: pulumi.String("x-host"), +// Tags: pulumi.StringArray{ +// pulumi.String("a"), +// pulumi.String("b"), +// }, +// ClientCertificateId: certificate.ID(), +// Healthchecks: &kong.UpstreamHealthchecksArgs{ +// Active: &kong.UpstreamHealthchecksActiveArgs{ +// Type: pulumi.String("https"), +// HttpPath: pulumi.String("/status"), +// Timeout: pulumi.Int(10), +// Concurrency: pulumi.Int(20), +// HttpsVerifyCertificate: pulumi.Bool(false), +// HttpsSni: pulumi.String("some.domain.com"), +// Healthy: &kong.UpstreamHealthchecksActiveHealthyArgs{ +// Successes: pulumi.Int(1), +// Interval: pulumi.Int(5), +// HttpStatuses: pulumi.IntArray{ +// pulumi.Int(200), +// pulumi.Int(201), +// }, +// }, +// Unhealthy: &kong.UpstreamHealthchecksActiveUnhealthyArgs{ +// Timeouts: pulumi.Int(7), +// Interval: pulumi.Int(3), +// TcpFailures: pulumi.Int(1), +// HttpFailures: pulumi.Int(2), +// HttpStatuses: pulumi.IntArray{ +// pulumi.Int(500), +// pulumi.Int(501), +// }, +// }, +// }, +// Passive: &kong.UpstreamHealthchecksPassiveArgs{ +// Type: pulumi.String("https"), +// Healthy: &kong.UpstreamHealthchecksPassiveHealthyArgs{ +// Successes: pulumi.Int(1), +// HttpStatuses: pulumi.IntArray{ +// pulumi.Int(200), +// pulumi.Int(201), +// pulumi.Int(202), +// }, +// }, +// Unhealthy: &kong.UpstreamHealthchecksPassiveUnhealthyArgs{ +// Timeouts: pulumi.Int(3), +// TcpFailures: pulumi.Int(5), +// HttpFailures: pulumi.Int(6), +// HttpStatuses: pulumi.IntArray{ +// pulumi.Int(500), +// pulumi.Int(501), +// pulumi.Int(502), +// }, +// }, +// }, +// }, +// }) +// if err != nil { +// return err +// } +// return nil +// }) +// } +// +// ``` +// // ## Import // // # To import an upstream diff --git a/sdk/nodejs/certificate.ts b/sdk/nodejs/certificate.ts index 13139ebc..3f99c967 100644 --- a/sdk/nodejs/certificate.ts +++ b/sdk/nodejs/certificate.ts @@ -9,6 +9,23 @@ import * as utilities from "./utilities"; * * For more information on creating certificates in Kong [see their documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#certificate-object) * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const certificate = new kong.Certificate("certificate", { + * certificate: "public key --- 123 ----", + * privateKey: "private key --- 456 ----", + * snis: [ + * "foo.com", + * "bar.com", + * ], + * tags: ["myTag"], + * }); + * ``` + * * ## Import * * To import a certificate diff --git a/sdk/nodejs/consumer.ts b/sdk/nodejs/consumer.ts index d41b149e..4babaae0 100644 --- a/sdk/nodejs/consumer.ts +++ b/sdk/nodejs/consumer.ts @@ -9,6 +9,19 @@ import * as utilities from "./utilities"; * * The consumer resource maps directly onto the json for creating a Consumer in Kong. For more information on the parameters [see the Kong Consumer create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#consumer-object). * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const consumer = new kong.Consumer("consumer", { + * customId: "123", + * tags: ["mySuperTag"], + * username: "User1", + * }); + * ``` + * * ## Import * * To import a consumer diff --git a/sdk/nodejs/consumerAcl.ts b/sdk/nodejs/consumerAcl.ts index f67cd5d3..c7382c9a 100644 --- a/sdk/nodejs/consumerAcl.ts +++ b/sdk/nodejs/consumerAcl.ts @@ -8,6 +8,31 @@ import * as utilities from "./utilities"; * ## # kong.ConsumerAcl * * Consumer ACL is a resource that allows you to configure the acl plugin for a consumer. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const myConsumer = new kong.Consumer("myConsumer", { + * customId: "123", + * username: "User1", + * }); + * const aclPlugin = new kong.Plugin("aclPlugin", {configJson: ` { + * "allow": ["group1", "group2"] + * } + * + * `}); + * const consumerAcl = new kong.ConsumerAcl("consumerAcl", { + * consumerId: myConsumer.id, + * group: "group2", + * tags: [ + * "myTag", + * "otherTag", + * ], + * }); + * ``` */ export class ConsumerAcl extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/consumerBasicAuth.ts b/sdk/nodejs/consumerBasicAuth.ts index 0aca1243..b3756c37 100644 --- a/sdk/nodejs/consumerBasicAuth.ts +++ b/sdk/nodejs/consumerBasicAuth.ts @@ -8,6 +8,28 @@ import * as utilities from "./utilities"; * ## # kong.ConsumerBasicAuth * * Consumer basic auth is a resource that allows you to configure the basic auth plugin for a consumer. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const myConsumer = new kong.Consumer("myConsumer", { + * customId: "123", + * username: "User1", + * }); + * const basicAuthPlugin = new kong.Plugin("basicAuthPlugin", {}); + * const consumerBasicAuth = new kong.ConsumerBasicAuth("consumerBasicAuth", { + * consumerId: myConsumer.id, + * password: "bar_updated", + * tags: [ + * "myTag", + * "anotherTag", + * ], + * username: "foo_updated", + * }); + * ``` */ export class ConsumerBasicAuth extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/consumerJwtAuth.ts b/sdk/nodejs/consumerJwtAuth.ts index a7f4b7ca..b4b8abd7 100644 --- a/sdk/nodejs/consumerJwtAuth.ts +++ b/sdk/nodejs/consumerJwtAuth.ts @@ -8,6 +8,30 @@ import * as utilities from "./utilities"; * ## # kong.ConsumerJwtAuth * * Consumer jwt auth is a resource that allows you to configure the jwt auth plugin for a consumer. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const myConsumer = new kong.Consumer("myConsumer", { + * customId: "123", + * username: "User1", + * }); + * const jwtPlugin = new kong.Plugin("jwtPlugin", {configJson: ` { + * "claims_to_verify": ["exp"] + * } + * + * `}); + * const consumerJwtConfig = new kong.ConsumerJwtAuth("consumerJwtConfig", { + * algorithm: "HS256", + * consumerId: myConsumer.id, + * key: "my_key", + * rsaPublicKey: "foo", + * secret: "my_secret", + * }); + * ``` */ export class ConsumerJwtAuth extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/consumerKeyAuth.ts b/sdk/nodejs/consumerKeyAuth.ts index 92ffcbce..0a5107cd 100644 --- a/sdk/nodejs/consumerKeyAuth.ts +++ b/sdk/nodejs/consumerKeyAuth.ts @@ -8,6 +8,27 @@ import * as utilities from "./utilities"; * ## # kong.ConsumerKeyAuth * * Resource that allows you to configure the [Key Authentication](https://docs.konghq.com/hub/kong-inc/key-auth/) plugin for a consumer. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const myConsumer = new kong.Consumer("myConsumer", { + * username: "User1", + * customId: "123", + * }); + * const keyAuthPlugin = new kong.Plugin("keyAuthPlugin", {}); + * const consumerKeyAuth = new kong.ConsumerKeyAuth("consumerKeyAuth", { + * consumerId: myConsumer.id, + * key: "secret", + * tags: [ + * "myTag", + * "anotherTag", + * ], + * }); + * ``` */ export class ConsumerKeyAuth extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/consumerOauth2.ts b/sdk/nodejs/consumerOauth2.ts index 26096e20..4cecd0d2 100644 --- a/sdk/nodejs/consumerOauth2.ts +++ b/sdk/nodejs/consumerOauth2.ts @@ -8,6 +8,37 @@ import * as utilities from "./utilities"; * ## # kong.ConsumerOauth2 * * Resource that allows you to configure the OAuth2 plugin credentials for a consumer. + * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const myConsumer = new kong.Consumer("myConsumer", { + * customId: "123", + * username: "User1", + * }); + * const oauth2Plugin = new kong.Plugin("oauth2Plugin", {configJson: ` { + * "global_credentials": true, + * "enable_password_grant": true, + * "token_expiration": 180, + * "refresh_token_ttl": 180, + * "provision_key": "testprovisionkey" + * } + * + * `}); + * const consumerOauth2 = new kong.ConsumerOauth2("consumerOauth2", { + * clientId: "client_id", + * clientSecret: "client_secret", + * consumerId: myConsumer.id, + * redirectUris: [ + * "https://asdf.com/callback", + * "https://test.cl/callback", + * ], + * tags: ["myTag"], + * }); + * ``` */ export class ConsumerOauth2 extends pulumi.CustomResource { /** diff --git a/sdk/nodejs/plugin.ts b/sdk/nodejs/plugin.ts index 8aceb54b..6640b355 100644 --- a/sdk/nodejs/plugin.ts +++ b/sdk/nodejs/plugin.ts @@ -10,6 +10,83 @@ import * as utilities from "./utilities"; * The plugin resource maps directly onto the json for the API endpoint in Kong. For more information on the parameters [see the Kong Api create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#plugin-object). * The `configJson` is passed through to the plugin to configure it as is. * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const rateLimit = new kong.Plugin("rateLimit", {configJson: ` { + * "second": 5, + * "hour" : 1000 + * } + * + * `}); + * ``` + * To apply a plugin to a consumer use the `consumerId` property, for example: + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const pluginConsumer = new kong.Consumer("pluginConsumer", { + * customId: "567", + * username: "PluginUser", + * }); + * const rateLimit = new kong.Plugin("rateLimit", { + * configJson: ` { + * "second": 5, + * "hour" : 1000 + * } + * + * `, + * consumerId: pluginConsumer.id, + * }); + * ``` + * + * To apply a plugin to a service use the `serviceId` property, for example: + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const service = new kong.Service("service", { + * host: "test.org", + * protocol: "http", + * }); + * const rateLimit = new kong.Plugin("rateLimit", { + * configJson: ` { + * "second": 10, + * "hour" : 2000 + * } + * + * `, + * serviceId: service.id, + * }); + * ``` + * + * To apply a plugin to a route use the `routeId` property, for example: + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const service = new kong.Service("service", { + * host: "test.org", + * protocol: "http", + * }); + * const rateLimit = new kong.Plugin("rateLimit", { + * configJson: ` { + * "second": 11, + * "hour" : 4000 + * } + * + * `, + * enabled: true, + * serviceId: service.id, + * }); + * ``` + * * ## Import * * To import a plugin diff --git a/sdk/nodejs/route.ts b/sdk/nodejs/route.ts index b5811f4c..0e6051d7 100644 --- a/sdk/nodejs/route.ts +++ b/sdk/nodejs/route.ts @@ -13,6 +13,65 @@ import * as utilities from "./utilities"; * * To create a tcp/tls route you set `sources` and `destinations` by repeating the corresponding element (`source` or `destination`) for each source or destination you want. * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const route = new kong.Route("route", { + * protocols: [ + * "http", + * "https", + * ], + * methods: [ + * "GET", + * "POST", + * ], + * hosts: ["example2.com"], + * paths: ["/test"], + * stripPath: false, + * preserveHost: true, + * regexPriority: 1, + * serviceId: kong_service.service.id, + * headers: [{ + * name: "x-test-1", + * values: [ + * "a", + * "b", + * ], + * }], + * }); + * ``` + * + * To create a tcp/tls route you set `sources` and `destinations` by repeating the corresponding element (`source` or `destination`) for each source or destination you want, for example: + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const route = new kong.Route("route", { + * protocols: ["tcp"], + * stripPath: true, + * preserveHost: false, + * sources: [ + * { + * ip: "192.168.1.1", + * port: 80, + * }, + * { + * ip: "192.168.1.2", + * }, + * ], + * destinations: [{ + * ip: "172.10.1.1", + * port: 81, + * }], + * snis: ["foo.com"], + * serviceId: kong_service.service.id, + * }); + * ``` + * * ## Import * * To import a route diff --git a/sdk/nodejs/service.ts b/sdk/nodejs/service.ts index e99ba897..0a0754bb 100644 --- a/sdk/nodejs/service.ts +++ b/sdk/nodejs/service.ts @@ -9,6 +9,62 @@ import * as utilities from "./utilities"; * * The service resource maps directly onto the json for the service endpoint in Kong. For more information on the parameters [see the Kong Service create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#service-object). * + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const service = new kong.Service("service", { + * connectTimeout: 1000, + * host: "test.org", + * path: "/mypath", + * port: 8080, + * protocol: "http", + * readTimeout: 3000, + * retries: 5, + * writeTimeout: 2000, + * }); + * ``` + * + * To use a client certificate and ca certificates combine with certificate resource (note protocol must be `https`): + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const certificate = new kong.Certificate("certificate", { + * certificate: ` -----BEGIN CERTIFICATE----- + * ...... + * -----END CERTIFICATE----- + * `, + * privateKey: ` -----BEGIN PRIVATE KEY----- + * ..... + * -----END PRIVATE KEY----- + * `, + * snis: ["foo.com"], + * }); + * const ca = new kong.Certificate("ca", { + * certificate: ` -----BEGIN CERTIFICATE----- + * ...... + * -----END CERTIFICATE----- + * `, + * privateKey: ` -----BEGIN PRIVATE KEY----- + * ..... + * -----END PRIVATE KEY----- + * `, + * snis: ["ca.com"], + * }); + * const service = new kong.Service("service", { + * protocol: "https", + * host: "test.org", + * tlsVerify: true, + * tlsVerifyDepth: 2, + * clientCertificateId: certificate.id, + * caCertificateIds: [ca.id], + * }); + * ``` + * * ## Import * * To import a service diff --git a/sdk/nodejs/target.ts b/sdk/nodejs/target.ts index 2e302b3f..e7b9c86e 100644 --- a/sdk/nodejs/target.ts +++ b/sdk/nodejs/target.ts @@ -5,6 +5,19 @@ import * as pulumi from "@pulumi/pulumi"; import * as utilities from "./utilities"; /** + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const target = new kong.Target("target", { + * target: "sample_target:80", + * upstreamId: kong_upstream.upstream.id, + * weight: 10, + * }); + * ``` + * * ## Import * * To import a target use a combination of the upstream id and the target id as follows diff --git a/sdk/nodejs/upstream.ts b/sdk/nodejs/upstream.ts index 91bca8a9..78383500 100644 --- a/sdk/nodejs/upstream.ts +++ b/sdk/nodejs/upstream.ts @@ -7,6 +7,89 @@ import * as outputs from "./types/output"; import * as utilities from "./utilities"; /** + * ## Example Usage + * + * ```typescript + * import * as pulumi from "@pulumi/pulumi"; + * import * as kong from "@pulumi/kong"; + * + * const certificate = new kong.Certificate("certificate", { + * certificate: ` -----BEGIN CERTIFICATE----- + * ...... + * -----END CERTIFICATE----- + * `, + * privateKey: ` -----BEGIN PRIVATE KEY----- + * ..... + * -----END PRIVATE KEY----- + * `, + * snis: ["foo.com"], + * }); + * const upstream = new kong.Upstream("upstream", { + * slots: 10, + * hashOn: "header", + * hashFallback: "cookie", + * hashOnHeader: "HeaderName", + * hashFallbackHeader: "FallbackHeaderName", + * hashOnCookie: "CookieName", + * hashOnCookiePath: "/path", + * hostHeader: "x-host", + * tags: [ + * "a", + * "b", + * ], + * clientCertificateId: certificate.id, + * healthchecks: { + * active: { + * type: "https", + * httpPath: "/status", + * timeout: 10, + * concurrency: 20, + * httpsVerifyCertificate: false, + * httpsSni: "some.domain.com", + * healthy: { + * successes: 1, + * interval: 5, + * httpStatuses: [ + * 200, + * 201, + * ], + * }, + * unhealthy: { + * timeouts: 7, + * interval: 3, + * tcpFailures: 1, + * httpFailures: 2, + * httpStatuses: [ + * 500, + * 501, + * ], + * }, + * }, + * passive: { + * type: "https", + * healthy: { + * successes: 1, + * httpStatuses: [ + * 200, + * 201, + * 202, + * ], + * }, + * unhealthy: { + * timeouts: 3, + * tcpFailures: 5, + * httpFailures: 6, + * httpStatuses: [ + * 500, + * 501, + * 502, + * ], + * }, + * }, + * }, + * }); + * ``` + * * ## Import * * To import an upstream diff --git a/sdk/python/pulumi_kong/certificate.py b/sdk/python/pulumi_kong/certificate.py index 3ed43452..46839922 100644 --- a/sdk/python/pulumi_kong/certificate.py +++ b/sdk/python/pulumi_kong/certificate.py @@ -201,6 +201,22 @@ def __init__(__self__, For more information on creating certificates in Kong [see their documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#certificate-object) + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + certificate = kong.Certificate("certificate", + certificate="public key --- 123 ----", + private_key="private key --- 456 ----", + snis=[ + "foo.com", + "bar.com", + ], + tags=["myTag"]) + ``` + ## Import To import a certificate @@ -226,6 +242,22 @@ def __init__(__self__, For more information on creating certificates in Kong [see their documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#certificate-object) + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + certificate = kong.Certificate("certificate", + certificate="public key --- 123 ----", + private_key="private key --- 456 ----", + snis=[ + "foo.com", + "bar.com", + ], + tags=["myTag"]) + ``` + ## Import To import a certificate diff --git a/sdk/python/pulumi_kong/consumer.py b/sdk/python/pulumi_kong/consumer.py index 217243a9..4ca64f1f 100644 --- a/sdk/python/pulumi_kong/consumer.py +++ b/sdk/python/pulumi_kong/consumer.py @@ -171,6 +171,18 @@ def __init__(__self__, The consumer resource maps directly onto the json for creating a Consumer in Kong. For more information on the parameters [see the Kong Consumer create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#consumer-object). + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + consumer = kong.Consumer("consumer", + custom_id="123", + tags=["mySuperTag"], + username="User1") + ``` + ## Import To import a consumer @@ -196,6 +208,18 @@ def __init__(__self__, The consumer resource maps directly onto the json for creating a Consumer in Kong. For more information on the parameters [see the Kong Consumer create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#consumer-object). + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + consumer = kong.Consumer("consumer", + custom_id="123", + tags=["mySuperTag"], + username="User1") + ``` + ## Import To import a consumer diff --git a/sdk/python/pulumi_kong/consumer_acl.py b/sdk/python/pulumi_kong/consumer_acl.py index e446c763..76453c2a 100644 --- a/sdk/python/pulumi_kong/consumer_acl.py +++ b/sdk/python/pulumi_kong/consumer_acl.py @@ -173,6 +173,29 @@ def __init__(__self__, Consumer ACL is a resource that allows you to configure the acl plugin for a consumer. + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + my_consumer = kong.Consumer("myConsumer", + custom_id="123", + username="User1") + acl_plugin = kong.Plugin("aclPlugin", config_json=\"\"\" { + "allow": ["group1", "group2"] + } + + \"\"\") + consumer_acl = kong.ConsumerAcl("consumerAcl", + consumer_id=my_consumer.id, + group="group2", + tags=[ + "myTag", + "otherTag", + ]) + ``` + :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] consumer_id: the id of the consumer to be configured @@ -190,6 +213,29 @@ def __init__(__self__, Consumer ACL is a resource that allows you to configure the acl plugin for a consumer. + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + my_consumer = kong.Consumer("myConsumer", + custom_id="123", + username="User1") + acl_plugin = kong.Plugin("aclPlugin", config_json=\"\"\" { + "allow": ["group1", "group2"] + } + + \"\"\") + consumer_acl = kong.ConsumerAcl("consumerAcl", + consumer_id=my_consumer.id, + group="group2", + tags=[ + "myTag", + "otherTag", + ]) + ``` + :param str resource_name: The name of the resource. :param ConsumerAclArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource. diff --git a/sdk/python/pulumi_kong/consumer_basic_auth.py b/sdk/python/pulumi_kong/consumer_basic_auth.py index b970fcc8..dcd11e5a 100644 --- a/sdk/python/pulumi_kong/consumer_basic_auth.py +++ b/sdk/python/pulumi_kong/consumer_basic_auth.py @@ -211,6 +211,26 @@ def __init__(__self__, Consumer basic auth is a resource that allows you to configure the basic auth plugin for a consumer. + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + my_consumer = kong.Consumer("myConsumer", + custom_id="123", + username="User1") + basic_auth_plugin = kong.Plugin("basicAuthPlugin") + consumer_basic_auth = kong.ConsumerBasicAuth("consumerBasicAuth", + consumer_id=my_consumer.id, + password="bar_updated", + tags=[ + "myTag", + "anotherTag", + ], + username="foo_updated") + ``` + :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] consumer_id: the id of the consumer to be configured with basic auth @@ -229,6 +249,26 @@ def __init__(__self__, Consumer basic auth is a resource that allows you to configure the basic auth plugin for a consumer. + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + my_consumer = kong.Consumer("myConsumer", + custom_id="123", + username="User1") + basic_auth_plugin = kong.Plugin("basicAuthPlugin") + consumer_basic_auth = kong.ConsumerBasicAuth("consumerBasicAuth", + consumer_id=my_consumer.id, + password="bar_updated", + tags=[ + "myTag", + "anotherTag", + ], + username="foo_updated") + ``` + :param str resource_name: The name of the resource. :param ConsumerBasicAuthArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource. diff --git a/sdk/python/pulumi_kong/consumer_jwt_auth.py b/sdk/python/pulumi_kong/consumer_jwt_auth.py index a31aba40..a0bc1b67 100644 --- a/sdk/python/pulumi_kong/consumer_jwt_auth.py +++ b/sdk/python/pulumi_kong/consumer_jwt_auth.py @@ -288,6 +288,28 @@ def __init__(__self__, Consumer jwt auth is a resource that allows you to configure the jwt auth plugin for a consumer. + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + my_consumer = kong.Consumer("myConsumer", + custom_id="123", + username="User1") + jwt_plugin = kong.Plugin("jwtPlugin", config_json=\"\"\" { + "claims_to_verify": ["exp"] + } + + \"\"\") + consumer_jwt_config = kong.ConsumerJwtAuth("consumerJwtConfig", + algorithm="HS256", + consumer_id=my_consumer.id, + key="my_key", + rsa_public_key="foo", + secret="my_secret") + ``` + :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] algorithm: The algorithm used to verify the token’s signature. Can be HS256, HS384, HS512, RS256, or ES256, Default is `HS256` @@ -308,6 +330,28 @@ def __init__(__self__, Consumer jwt auth is a resource that allows you to configure the jwt auth plugin for a consumer. + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + my_consumer = kong.Consumer("myConsumer", + custom_id="123", + username="User1") + jwt_plugin = kong.Plugin("jwtPlugin", config_json=\"\"\" { + "claims_to_verify": ["exp"] + } + + \"\"\") + consumer_jwt_config = kong.ConsumerJwtAuth("consumerJwtConfig", + algorithm="HS256", + consumer_id=my_consumer.id, + key="my_key", + rsa_public_key="foo", + secret="my_secret") + ``` + :param str resource_name: The name of the resource. :param ConsumerJwtAuthArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource. diff --git a/sdk/python/pulumi_kong/consumer_key_auth.py b/sdk/python/pulumi_kong/consumer_key_auth.py index 17b42de4..cceb6307 100644 --- a/sdk/python/pulumi_kong/consumer_key_auth.py +++ b/sdk/python/pulumi_kong/consumer_key_auth.py @@ -172,6 +172,25 @@ def __init__(__self__, Resource that allows you to configure the [Key Authentication](https://docs.konghq.com/hub/kong-inc/key-auth/) plugin for a consumer. + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + my_consumer = kong.Consumer("myConsumer", + username="User1", + custom_id="123") + key_auth_plugin = kong.Plugin("keyAuthPlugin") + consumer_key_auth = kong.ConsumerKeyAuth("consumerKeyAuth", + consumer_id=my_consumer.id, + key="secret", + tags=[ + "myTag", + "anotherTag", + ]) + ``` + :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] consumer_id: the id of the consumer to associate the credentials to @@ -189,6 +208,25 @@ def __init__(__self__, Resource that allows you to configure the [Key Authentication](https://docs.konghq.com/hub/kong-inc/key-auth/) plugin for a consumer. + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + my_consumer = kong.Consumer("myConsumer", + username="User1", + custom_id="123") + key_auth_plugin = kong.Plugin("keyAuthPlugin") + consumer_key_auth = kong.ConsumerKeyAuth("consumerKeyAuth", + consumer_id=my_consumer.id, + key="secret", + tags=[ + "myTag", + "anotherTag", + ]) + ``` + :param str resource_name: The name of the resource. :param ConsumerKeyAuthArgs args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource. diff --git a/sdk/python/pulumi_kong/consumer_oauth2.py b/sdk/python/pulumi_kong/consumer_oauth2.py index ec520508..5cf67e8b 100644 --- a/sdk/python/pulumi_kong/consumer_oauth2.py +++ b/sdk/python/pulumi_kong/consumer_oauth2.py @@ -337,6 +337,35 @@ def __init__(__self__, Resource that allows you to configure the OAuth2 plugin credentials for a consumer. + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + my_consumer = kong.Consumer("myConsumer", + custom_id="123", + username="User1") + oauth2_plugin = kong.Plugin("oauth2Plugin", config_json=\"\"\" { + "global_credentials": true, + "enable_password_grant": true, + "token_expiration": 180, + "refresh_token_ttl": 180, + "provision_key": "testprovisionkey" + } + + \"\"\") + consumer_oauth2 = kong.ConsumerOauth2("consumerOauth2", + client_id="client_id", + client_secret="client_secret", + consumer_id=my_consumer.id, + redirect_uris=[ + "https://asdf.com/callback", + "https://test.cl/callback", + ], + tags=["myTag"]) + ``` + :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] client_id: Unique oauth2 client id. If not set, the oauth2 plugin will generate one @@ -358,6 +387,35 @@ def __init__(__self__, Resource that allows you to configure the OAuth2 plugin credentials for a consumer. + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + my_consumer = kong.Consumer("myConsumer", + custom_id="123", + username="User1") + oauth2_plugin = kong.Plugin("oauth2Plugin", config_json=\"\"\" { + "global_credentials": true, + "enable_password_grant": true, + "token_expiration": 180, + "refresh_token_ttl": 180, + "provision_key": "testprovisionkey" + } + + \"\"\") + consumer_oauth2 = kong.ConsumerOauth2("consumerOauth2", + client_id="client_id", + client_secret="client_secret", + consumer_id=my_consumer.id, + redirect_uris=[ + "https://asdf.com/callback", + "https://test.cl/callback", + ], + tags=["myTag"]) + ``` + :param str resource_name: The name of the resource. :param ConsumerOauth2Args args: The arguments to use to populate this resource's properties. :param pulumi.ResourceOptions opts: Options for the resource. diff --git a/sdk/python/pulumi_kong/plugin.py b/sdk/python/pulumi_kong/plugin.py index 12396379..4cc19054 100644 --- a/sdk/python/pulumi_kong/plugin.py +++ b/sdk/python/pulumi_kong/plugin.py @@ -377,6 +377,77 @@ def __init__(__self__, The plugin resource maps directly onto the json for the API endpoint in Kong. For more information on the parameters [see the Kong Api create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#plugin-object). The `config_json` is passed through to the plugin to configure it as is. + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + rate_limit = kong.Plugin("rateLimit", config_json=\"\"\" { + "second": 5, + "hour" : 1000 + } + + \"\"\") + ``` + To apply a plugin to a consumer use the `consumer_id` property, for example: + + ```python + import pulumi + import pulumi_kong as kong + + plugin_consumer = kong.Consumer("pluginConsumer", + custom_id="567", + username="PluginUser") + rate_limit = kong.Plugin("rateLimit", + config_json=\"\"\" { + "second": 5, + "hour" : 1000 + } + + \"\"\", + consumer_id=plugin_consumer.id) + ``` + + To apply a plugin to a service use the `service_id` property, for example: + + ```python + import pulumi + import pulumi_kong as kong + + service = kong.Service("service", + host="test.org", + protocol="http") + rate_limit = kong.Plugin("rateLimit", + config_json=\"\"\" { + "second": 10, + "hour" : 2000 + } + + \"\"\", + service_id=service.id) + ``` + + To apply a plugin to a route use the `route_id` property, for example: + + ```python + import pulumi + import pulumi_kong as kong + + service = kong.Service("service", + host="test.org", + protocol="http") + rate_limit = kong.Plugin("rateLimit", + config_json=\"\"\" { + "second": 11, + "hour" : 4000 + } + + \"\"\", + enabled=True, + service_id=service.id) + ``` + ## Import To import a plugin @@ -407,6 +478,77 @@ def __init__(__self__, The plugin resource maps directly onto the json for the API endpoint in Kong. For more information on the parameters [see the Kong Api create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#plugin-object). The `config_json` is passed through to the plugin to configure it as is. + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + rate_limit = kong.Plugin("rateLimit", config_json=\"\"\" { + "second": 5, + "hour" : 1000 + } + + \"\"\") + ``` + To apply a plugin to a consumer use the `consumer_id` property, for example: + + ```python + import pulumi + import pulumi_kong as kong + + plugin_consumer = kong.Consumer("pluginConsumer", + custom_id="567", + username="PluginUser") + rate_limit = kong.Plugin("rateLimit", + config_json=\"\"\" { + "second": 5, + "hour" : 1000 + } + + \"\"\", + consumer_id=plugin_consumer.id) + ``` + + To apply a plugin to a service use the `service_id` property, for example: + + ```python + import pulumi + import pulumi_kong as kong + + service = kong.Service("service", + host="test.org", + protocol="http") + rate_limit = kong.Plugin("rateLimit", + config_json=\"\"\" { + "second": 10, + "hour" : 2000 + } + + \"\"\", + service_id=service.id) + ``` + + To apply a plugin to a route use the `route_id` property, for example: + + ```python + import pulumi + import pulumi_kong as kong + + service = kong.Service("service", + host="test.org", + protocol="http") + rate_limit = kong.Plugin("rateLimit", + config_json=\"\"\" { + "second": 11, + "hour" : 4000 + } + + \"\"\", + enabled=True, + service_id=service.id) + ``` + ## Import To import a plugin diff --git a/sdk/python/pulumi_kong/route.py b/sdk/python/pulumi_kong/route.py index 1079c9a4..9d8a8a76 100644 --- a/sdk/python/pulumi_kong/route.py +++ b/sdk/python/pulumi_kong/route.py @@ -760,6 +760,63 @@ def __init__(__self__, To create a tcp/tls route you set `sources` and `destinations` by repeating the corresponding element (`source` or `destination`) for each source or destination you want. + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + route = kong.Route("route", + protocols=[ + "http", + "https", + ], + methods=[ + "GET", + "POST", + ], + hosts=["example2.com"], + paths=["/test"], + strip_path=False, + preserve_host=True, + regex_priority=1, + service_id=kong_service["service"]["id"], + headers=[kong.RouteHeaderArgs( + name="x-test-1", + values=[ + "a", + "b", + ], + )]) + ``` + + To create a tcp/tls route you set `sources` and `destinations` by repeating the corresponding element (`source` or `destination`) for each source or destination you want, for example: + + ```python + import pulumi + import pulumi_kong as kong + + route = kong.Route("route", + protocols=["tcp"], + strip_path=True, + preserve_host=False, + sources=[ + kong.RouteSourceArgs( + ip="192.168.1.1", + port=80, + ), + kong.RouteSourceArgs( + ip="192.168.1.2", + ), + ], + destinations=[kong.RouteDestinationArgs( + ip="172.10.1.1", + port=81, + )], + snis=["foo.com"], + service_id=kong_service["service"]["id"]) + ``` + ## Import To import a route @@ -802,6 +859,63 @@ def __init__(__self__, To create a tcp/tls route you set `sources` and `destinations` by repeating the corresponding element (`source` or `destination`) for each source or destination you want. + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + route = kong.Route("route", + protocols=[ + "http", + "https", + ], + methods=[ + "GET", + "POST", + ], + hosts=["example2.com"], + paths=["/test"], + strip_path=False, + preserve_host=True, + regex_priority=1, + service_id=kong_service["service"]["id"], + headers=[kong.RouteHeaderArgs( + name="x-test-1", + values=[ + "a", + "b", + ], + )]) + ``` + + To create a tcp/tls route you set `sources` and `destinations` by repeating the corresponding element (`source` or `destination`) for each source or destination you want, for example: + + ```python + import pulumi + import pulumi_kong as kong + + route = kong.Route("route", + protocols=["tcp"], + strip_path=True, + preserve_host=False, + sources=[ + kong.RouteSourceArgs( + ip="192.168.1.1", + port=80, + ), + kong.RouteSourceArgs( + ip="192.168.1.2", + ), + ], + destinations=[kong.RouteDestinationArgs( + ip="172.10.1.1", + port=81, + )], + snis=["foo.com"], + service_id=kong_service["service"]["id"]) + ``` + ## Import To import a route diff --git a/sdk/python/pulumi_kong/service.py b/sdk/python/pulumi_kong/service.py index 8bc069d2..e071c41d 100644 --- a/sdk/python/pulumi_kong/service.py +++ b/sdk/python/pulumi_kong/service.py @@ -603,6 +603,58 @@ def __init__(__self__, The service resource maps directly onto the json for the service endpoint in Kong. For more information on the parameters [see the Kong Service create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#service-object). + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + service = kong.Service("service", + connect_timeout=1000, + host="test.org", + path="/mypath", + port=8080, + protocol="http", + read_timeout=3000, + retries=5, + write_timeout=2000) + ``` + + To use a client certificate and ca certificates combine with certificate resource (note protocol must be `https`): + + ```python + import pulumi + import pulumi_kong as kong + + certificate = kong.Certificate("certificate", + certificate=\"\"\" -----BEGIN CERTIFICATE----- + ...... + -----END CERTIFICATE----- + \"\"\", + private_key=\"\"\" -----BEGIN PRIVATE KEY----- + ..... + -----END PRIVATE KEY----- + \"\"\", + snis=["foo.com"]) + ca = kong.Certificate("ca", + certificate=\"\"\" -----BEGIN CERTIFICATE----- + ...... + -----END CERTIFICATE----- + \"\"\", + private_key=\"\"\" -----BEGIN PRIVATE KEY----- + ..... + -----END PRIVATE KEY----- + \"\"\", + snis=["ca.com"]) + service = kong.Service("service", + protocol="https", + host="test.org", + tls_verify=True, + tls_verify_depth=2, + client_certificate_id=certificate.id, + ca_certificate_ids=[ca.id]) + ``` + ## Import To import a service @@ -639,6 +691,58 @@ def __init__(__self__, The service resource maps directly onto the json for the service endpoint in Kong. For more information on the parameters [see the Kong Service create documentation](https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#service-object). + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + service = kong.Service("service", + connect_timeout=1000, + host="test.org", + path="/mypath", + port=8080, + protocol="http", + read_timeout=3000, + retries=5, + write_timeout=2000) + ``` + + To use a client certificate and ca certificates combine with certificate resource (note protocol must be `https`): + + ```python + import pulumi + import pulumi_kong as kong + + certificate = kong.Certificate("certificate", + certificate=\"\"\" -----BEGIN CERTIFICATE----- + ...... + -----END CERTIFICATE----- + \"\"\", + private_key=\"\"\" -----BEGIN PRIVATE KEY----- + ..... + -----END PRIVATE KEY----- + \"\"\", + snis=["foo.com"]) + ca = kong.Certificate("ca", + certificate=\"\"\" -----BEGIN CERTIFICATE----- + ...... + -----END CERTIFICATE----- + \"\"\", + private_key=\"\"\" -----BEGIN PRIVATE KEY----- + ..... + -----END PRIVATE KEY----- + \"\"\", + snis=["ca.com"]) + service = kong.Service("service", + protocol="https", + host="test.org", + tls_verify=True, + tls_verify_depth=2, + client_certificate_id=certificate.id, + ca_certificate_ids=[ca.id]) + ``` + ## Import To import a service diff --git a/sdk/python/pulumi_kong/target.py b/sdk/python/pulumi_kong/target.py index 88b6a467..0c01176c 100644 --- a/sdk/python/pulumi_kong/target.py +++ b/sdk/python/pulumi_kong/target.py @@ -207,6 +207,18 @@ def __init__(__self__, weight: Optional[pulumi.Input[int]] = None, __props__=None): """ + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + target = kong.Target("target", + target="sample_target:80", + upstream_id=kong_upstream["upstream"]["id"], + weight=10) + ``` + ## Import To import a target use a combination of the upstream id and the target id as follows @@ -229,6 +241,18 @@ def __init__(__self__, args: TargetArgs, opts: Optional[pulumi.ResourceOptions] = None): """ + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + target = kong.Target("target", + target="sample_target:80", + upstream_id=kong_upstream["upstream"]["id"], + weight=10) + ``` + ## Import To import a target use a combination of the upstream id and the target id as follows diff --git a/sdk/python/pulumi_kong/upstream.py b/sdk/python/pulumi_kong/upstream.py index d99f1bda..be494711 100644 --- a/sdk/python/pulumi_kong/upstream.py +++ b/sdk/python/pulumi_kong/upstream.py @@ -606,6 +606,87 @@ def __init__(__self__, tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, __props__=None): """ + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + certificate = kong.Certificate("certificate", + certificate=\"\"\" -----BEGIN CERTIFICATE----- + ...... + -----END CERTIFICATE----- + \"\"\", + private_key=\"\"\" -----BEGIN PRIVATE KEY----- + ..... + -----END PRIVATE KEY----- + \"\"\", + snis=["foo.com"]) + upstream = kong.Upstream("upstream", + slots=10, + hash_on="header", + hash_fallback="cookie", + hash_on_header="HeaderName", + hash_fallback_header="FallbackHeaderName", + hash_on_cookie="CookieName", + hash_on_cookie_path="/path", + host_header="x-host", + tags=[ + "a", + "b", + ], + client_certificate_id=certificate.id, + healthchecks=kong.UpstreamHealthchecksArgs( + active=kong.UpstreamHealthchecksActiveArgs( + type="https", + http_path="/status", + timeout=10, + concurrency=20, + https_verify_certificate=False, + https_sni="some.domain.com", + healthy=kong.UpstreamHealthchecksActiveHealthyArgs( + successes=1, + interval=5, + http_statuses=[ + 200, + 201, + ], + ), + unhealthy=kong.UpstreamHealthchecksActiveUnhealthyArgs( + timeouts=7, + interval=3, + tcp_failures=1, + http_failures=2, + http_statuses=[ + 500, + 501, + ], + ), + ), + passive=kong.UpstreamHealthchecksPassiveArgs( + type="https", + healthy=kong.UpstreamHealthchecksPassiveHealthyArgs( + successes=1, + http_statuses=[ + 200, + 201, + 202, + ], + ), + unhealthy=kong.UpstreamHealthchecksPassiveUnhealthyArgs( + timeouts=3, + tcp_failures=5, + http_failures=6, + http_statuses=[ + 500, + 501, + 502, + ], + ), + ), + )) + ``` + ## Import To import an upstream @@ -656,6 +737,87 @@ def __init__(__self__, args: Optional[UpstreamArgs] = None, opts: Optional[pulumi.ResourceOptions] = None): """ + ## Example Usage + + ```python + import pulumi + import pulumi_kong as kong + + certificate = kong.Certificate("certificate", + certificate=\"\"\" -----BEGIN CERTIFICATE----- + ...... + -----END CERTIFICATE----- + \"\"\", + private_key=\"\"\" -----BEGIN PRIVATE KEY----- + ..... + -----END PRIVATE KEY----- + \"\"\", + snis=["foo.com"]) + upstream = kong.Upstream("upstream", + slots=10, + hash_on="header", + hash_fallback="cookie", + hash_on_header="HeaderName", + hash_fallback_header="FallbackHeaderName", + hash_on_cookie="CookieName", + hash_on_cookie_path="/path", + host_header="x-host", + tags=[ + "a", + "b", + ], + client_certificate_id=certificate.id, + healthchecks=kong.UpstreamHealthchecksArgs( + active=kong.UpstreamHealthchecksActiveArgs( + type="https", + http_path="/status", + timeout=10, + concurrency=20, + https_verify_certificate=False, + https_sni="some.domain.com", + healthy=kong.UpstreamHealthchecksActiveHealthyArgs( + successes=1, + interval=5, + http_statuses=[ + 200, + 201, + ], + ), + unhealthy=kong.UpstreamHealthchecksActiveUnhealthyArgs( + timeouts=7, + interval=3, + tcp_failures=1, + http_failures=2, + http_statuses=[ + 500, + 501, + ], + ), + ), + passive=kong.UpstreamHealthchecksPassiveArgs( + type="https", + healthy=kong.UpstreamHealthchecksPassiveHealthyArgs( + successes=1, + http_statuses=[ + 200, + 201, + 202, + ], + ), + unhealthy=kong.UpstreamHealthchecksPassiveUnhealthyArgs( + timeouts=3, + tcp_failures=5, + http_failures=6, + http_statuses=[ + 500, + 501, + 502, + ], + ), + ), + )) + ``` + ## Import To import an upstream