1. Packages
  2. Kong
  3. API Docs
  4. ConsumerKeyAuth
Kong v4.5.4 published on Monday, Jun 24, 2024 by Pulumi

kong.ConsumerKeyAuth

Explore with Pulumi AI

kong logo
Kong v4.5.4 published on Monday, Jun 24, 2024 by Pulumi

    # kong.ConsumerKeyAuth

    Resource that allows you to configure the Key Authentication plugin for a consumer.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as kong from "@pulumi/kong";
    
    const myConsumer = new kong.Consumer("my_consumer", {
        username: "User1",
        customId: "123",
    });
    const keyAuthPlugin = new kong.Plugin("key_auth_plugin", {name: "key-auth"});
    const consumerKeyAuth = new kong.ConsumerKeyAuth("consumer_key_auth", {
        consumerId: myConsumer.id,
        key: "secret",
        tags: [
            "myTag",
            "anotherTag",
        ],
    });
    
    import pulumi
    import pulumi_kong as kong
    
    my_consumer = kong.Consumer("my_consumer",
        username="User1",
        custom_id="123")
    key_auth_plugin = kong.Plugin("key_auth_plugin", name="key-auth")
    consumer_key_auth = kong.ConsumerKeyAuth("consumer_key_auth",
        consumer_id=my_consumer.id,
        key="secret",
        tags=[
            "myTag",
            "anotherTag",
        ])
    
    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, "my_consumer", &kong.ConsumerArgs{
    			Username: pulumi.String("User1"),
    			CustomId: pulumi.String("123"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = kong.NewPlugin(ctx, "key_auth_plugin", &kong.PluginArgs{
    			Name: pulumi.String("key-auth"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = kong.NewConsumerKeyAuth(ctx, "consumer_key_auth", &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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Kong = Pulumi.Kong;
    
    return await Deployment.RunAsync(() => 
    {
        var myConsumer = new Kong.Consumer("my_consumer", new()
        {
            Username = "User1",
            CustomId = "123",
        });
    
        var keyAuthPlugin = new Kong.Plugin("key_auth_plugin", new()
        {
            Name = "key-auth",
        });
    
        var consumerKeyAuth = new Kong.ConsumerKeyAuth("consumer_key_auth", new()
        {
            ConsumerId = myConsumer.Id,
            Key = "secret",
            Tags = new[]
            {
                "myTag",
                "anotherTag",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.kong.Consumer;
    import com.pulumi.kong.ConsumerArgs;
    import com.pulumi.kong.Plugin;
    import com.pulumi.kong.PluginArgs;
    import com.pulumi.kong.ConsumerKeyAuth;
    import com.pulumi.kong.ConsumerKeyAuthArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var myConsumer = new Consumer("myConsumer", ConsumerArgs.builder()
                .username("User1")
                .customId("123")
                .build());
    
            var keyAuthPlugin = new Plugin("keyAuthPlugin", PluginArgs.builder()
                .name("key-auth")
                .build());
    
            var consumerKeyAuth = new ConsumerKeyAuth("consumerKeyAuth", ConsumerKeyAuthArgs.builder()
                .consumerId(myConsumer.id())
                .key("secret")
                .tags(            
                    "myTag",
                    "anotherTag")
                .build());
    
        }
    }
    
    resources:
      myConsumer:
        type: kong:Consumer
        name: my_consumer
        properties:
          username: User1
          customId: '123'
      keyAuthPlugin:
        type: kong:Plugin
        name: key_auth_plugin
        properties:
          name: key-auth
      consumerKeyAuth:
        type: kong:ConsumerKeyAuth
        name: consumer_key_auth
        properties:
          consumerId: ${myConsumer.id}
          key: secret
          tags:
            - myTag
            - anotherTag
    

    Create ConsumerKeyAuth Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ConsumerKeyAuth(name: string, args: ConsumerKeyAuthArgs, opts?: CustomResourceOptions);
    @overload
    def ConsumerKeyAuth(resource_name: str,
                        args: ConsumerKeyAuthArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def ConsumerKeyAuth(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        consumer_id: Optional[str] = None,
                        key: Optional[str] = None,
                        tags: Optional[Sequence[str]] = None)
    func NewConsumerKeyAuth(ctx *Context, name string, args ConsumerKeyAuthArgs, opts ...ResourceOption) (*ConsumerKeyAuth, error)
    public ConsumerKeyAuth(string name, ConsumerKeyAuthArgs args, CustomResourceOptions? opts = null)
    public ConsumerKeyAuth(String name, ConsumerKeyAuthArgs args)
    public ConsumerKeyAuth(String name, ConsumerKeyAuthArgs args, CustomResourceOptions options)
    
    type: kong:ConsumerKeyAuth
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ConsumerKeyAuthArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ConsumerKeyAuthArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ConsumerKeyAuthArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ConsumerKeyAuthArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ConsumerKeyAuthArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var consumerKeyAuthResource = new Kong.ConsumerKeyAuth("consumerKeyAuthResource", new()
    {
        ConsumerId = "string",
        Key = "string",
        Tags = new[]
        {
            "string",
        },
    });
    
    example, err := kong.NewConsumerKeyAuth(ctx, "consumerKeyAuthResource", &kong.ConsumerKeyAuthArgs{
    	ConsumerId: pulumi.String("string"),
    	Key:        pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var consumerKeyAuthResource = new ConsumerKeyAuth("consumerKeyAuthResource", ConsumerKeyAuthArgs.builder()
        .consumerId("string")
        .key("string")
        .tags("string")
        .build());
    
    consumer_key_auth_resource = kong.ConsumerKeyAuth("consumerKeyAuthResource",
        consumer_id="string",
        key="string",
        tags=["string"])
    
    const consumerKeyAuthResource = new kong.ConsumerKeyAuth("consumerKeyAuthResource", {
        consumerId: "string",
        key: "string",
        tags: ["string"],
    });
    
    type: kong:ConsumerKeyAuth
    properties:
        consumerId: string
        key: string
        tags:
            - string
    

    ConsumerKeyAuth Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The ConsumerKeyAuth resource accepts the following input properties:

    ConsumerId string
    the id of the consumer to associate the credentials to
    Key string
    Unique key to authenticate the client; if omitted the plugin will generate one
    Tags List<string>
    A list of strings associated with the consumer key auth for grouping and filtering
    ConsumerId string
    the id of the consumer to associate the credentials to
    Key string
    Unique key to authenticate the client; if omitted the plugin will generate one
    Tags []string
    A list of strings associated with the consumer key auth for grouping and filtering
    consumerId String
    the id of the consumer to associate the credentials to
    key String
    Unique key to authenticate the client; if omitted the plugin will generate one
    tags List<String>
    A list of strings associated with the consumer key auth for grouping and filtering
    consumerId string
    the id of the consumer to associate the credentials to
    key string
    Unique key to authenticate the client; if omitted the plugin will generate one
    tags string[]
    A list of strings associated with the consumer key auth for grouping and filtering
    consumer_id str
    the id of the consumer to associate the credentials to
    key str
    Unique key to authenticate the client; if omitted the plugin will generate one
    tags Sequence[str]
    A list of strings associated with the consumer key auth for grouping and filtering
    consumerId String
    the id of the consumer to associate the credentials to
    key String
    Unique key to authenticate the client; if omitted the plugin will generate one
    tags List<String>
    A list of strings associated with the consumer key auth for grouping and filtering

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ConsumerKeyAuth resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ConsumerKeyAuth Resource

    Get an existing ConsumerKeyAuth resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ConsumerKeyAuthState, opts?: CustomResourceOptions): ConsumerKeyAuth
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            consumer_id: Optional[str] = None,
            key: Optional[str] = None,
            tags: Optional[Sequence[str]] = None) -> ConsumerKeyAuth
    func GetConsumerKeyAuth(ctx *Context, name string, id IDInput, state *ConsumerKeyAuthState, opts ...ResourceOption) (*ConsumerKeyAuth, error)
    public static ConsumerKeyAuth Get(string name, Input<string> id, ConsumerKeyAuthState? state, CustomResourceOptions? opts = null)
    public static ConsumerKeyAuth get(String name, Output<String> id, ConsumerKeyAuthState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ConsumerId string
    the id of the consumer to associate the credentials to
    Key string
    Unique key to authenticate the client; if omitted the plugin will generate one
    Tags List<string>
    A list of strings associated with the consumer key auth for grouping and filtering
    ConsumerId string
    the id of the consumer to associate the credentials to
    Key string
    Unique key to authenticate the client; if omitted the plugin will generate one
    Tags []string
    A list of strings associated with the consumer key auth for grouping and filtering
    consumerId String
    the id of the consumer to associate the credentials to
    key String
    Unique key to authenticate the client; if omitted the plugin will generate one
    tags List<String>
    A list of strings associated with the consumer key auth for grouping and filtering
    consumerId string
    the id of the consumer to associate the credentials to
    key string
    Unique key to authenticate the client; if omitted the plugin will generate one
    tags string[]
    A list of strings associated with the consumer key auth for grouping and filtering
    consumer_id str
    the id of the consumer to associate the credentials to
    key str
    Unique key to authenticate the client; if omitted the plugin will generate one
    tags Sequence[str]
    A list of strings associated with the consumer key auth for grouping and filtering
    consumerId String
    the id of the consumer to associate the credentials to
    key String
    Unique key to authenticate the client; if omitted the plugin will generate one
    tags List<String>
    A list of strings associated with the consumer key auth for grouping and filtering

    Package Details

    Repository
    Kong pulumi/pulumi-kong
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the kong Terraform Provider.
    kong logo
    Kong v4.5.4 published on Monday, Jun 24, 2024 by Pulumi