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

kong.ConsumerBasicAuth

Explore with Pulumi AI

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

    # kong.ConsumerBasicAuth

    Consumer basic auth is a resource that allows you to configure the basic auth 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 basicAuthPlugin = new kong.Plugin("basic_auth_plugin", {name: "basic-auth"});
    const consumerBasicAuth = new kong.ConsumerBasicAuth("consumer_basic_auth", {
        consumerId: myConsumer.id,
        username: "foo_updated",
        password: "bar_updated",
        tags: [
            "myTag",
            "anotherTag",
        ],
    });
    
    import pulumi
    import pulumi_kong as kong
    
    my_consumer = kong.Consumer("my_consumer",
        username="User1",
        custom_id="123")
    basic_auth_plugin = kong.Plugin("basic_auth_plugin", name="basic-auth")
    consumer_basic_auth = kong.ConsumerBasicAuth("consumer_basic_auth",
        consumer_id=my_consumer.id,
        username="foo_updated",
        password="bar_updated",
        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, "basic_auth_plugin", &kong.PluginArgs{
    			Name: pulumi.String("basic-auth"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = kong.NewConsumerBasicAuth(ctx, "consumer_basic_auth", &kong.ConsumerBasicAuthArgs{
    			ConsumerId: myConsumer.ID(),
    			Username:   pulumi.String("foo_updated"),
    			Password:   pulumi.String("bar_updated"),
    			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 basicAuthPlugin = new Kong.Plugin("basic_auth_plugin", new()
        {
            Name = "basic-auth",
        });
    
        var consumerBasicAuth = new Kong.ConsumerBasicAuth("consumer_basic_auth", new()
        {
            ConsumerId = myConsumer.Id,
            Username = "foo_updated",
            Password = "bar_updated",
            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.ConsumerBasicAuth;
    import com.pulumi.kong.ConsumerBasicAuthArgs;
    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 basicAuthPlugin = new Plugin("basicAuthPlugin", PluginArgs.builder()
                .name("basic-auth")
                .build());
    
            var consumerBasicAuth = new ConsumerBasicAuth("consumerBasicAuth", ConsumerBasicAuthArgs.builder()
                .consumerId(myConsumer.id())
                .username("foo_updated")
                .password("bar_updated")
                .tags(            
                    "myTag",
                    "anotherTag")
                .build());
    
        }
    }
    
    resources:
      myConsumer:
        type: kong:Consumer
        name: my_consumer
        properties:
          username: User1
          customId: '123'
      basicAuthPlugin:
        type: kong:Plugin
        name: basic_auth_plugin
        properties:
          name: basic-auth
      consumerBasicAuth:
        type: kong:ConsumerBasicAuth
        name: consumer_basic_auth
        properties:
          consumerId: ${myConsumer.id}
          username: foo_updated
          password: bar_updated
          tags:
            - myTag
            - anotherTag
    

    Create ConsumerBasicAuth Resource

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

    Constructor syntax

    new ConsumerBasicAuth(name: string, args: ConsumerBasicAuthArgs, opts?: CustomResourceOptions);
    @overload
    def ConsumerBasicAuth(resource_name: str,
                          args: ConsumerBasicAuthArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def ConsumerBasicAuth(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          consumer_id: Optional[str] = None,
                          password: Optional[str] = None,
                          username: Optional[str] = None,
                          tags: Optional[Sequence[str]] = None)
    func NewConsumerBasicAuth(ctx *Context, name string, args ConsumerBasicAuthArgs, opts ...ResourceOption) (*ConsumerBasicAuth, error)
    public ConsumerBasicAuth(string name, ConsumerBasicAuthArgs args, CustomResourceOptions? opts = null)
    public ConsumerBasicAuth(String name, ConsumerBasicAuthArgs args)
    public ConsumerBasicAuth(String name, ConsumerBasicAuthArgs args, CustomResourceOptions options)
    
    type: kong:ConsumerBasicAuth
    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 ConsumerBasicAuthArgs
    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 ConsumerBasicAuthArgs
    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 ConsumerBasicAuthArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ConsumerBasicAuthArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ConsumerBasicAuthArgs
    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 consumerBasicAuthResource = new Kong.ConsumerBasicAuth("consumerBasicAuthResource", new()
    {
        ConsumerId = "string",
        Password = "string",
        Username = "string",
        Tags = new[]
        {
            "string",
        },
    });
    
    example, err := kong.NewConsumerBasicAuth(ctx, "consumerBasicAuthResource", &kong.ConsumerBasicAuthArgs{
    	ConsumerId: pulumi.String("string"),
    	Password:   pulumi.String("string"),
    	Username:   pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var consumerBasicAuthResource = new ConsumerBasicAuth("consumerBasicAuthResource", ConsumerBasicAuthArgs.builder()
        .consumerId("string")
        .password("string")
        .username("string")
        .tags("string")
        .build());
    
    consumer_basic_auth_resource = kong.ConsumerBasicAuth("consumerBasicAuthResource",
        consumer_id="string",
        password="string",
        username="string",
        tags=["string"])
    
    const consumerBasicAuthResource = new kong.ConsumerBasicAuth("consumerBasicAuthResource", {
        consumerId: "string",
        password: "string",
        username: "string",
        tags: ["string"],
    });
    
    type: kong:ConsumerBasicAuth
    properties:
        consumerId: string
        password: string
        tags:
            - string
        username: string
    

    ConsumerBasicAuth 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 ConsumerBasicAuth resource accepts the following input properties:

    ConsumerId string
    the id of the consumer to be configured with basic auth
    Password string
    password to be used for basic auth
    Username string
    username to be used for basic auth
    Tags List<string>
    A list of strings associated with the consumer basic auth for grouping and filtering
    ConsumerId string
    the id of the consumer to be configured with basic auth
    Password string
    password to be used for basic auth
    Username string
    username to be used for basic auth
    Tags []string
    A list of strings associated with the consumer basic auth for grouping and filtering
    consumerId String
    the id of the consumer to be configured with basic auth
    password String
    password to be used for basic auth
    username String
    username to be used for basic auth
    tags List<String>
    A list of strings associated with the consumer basic auth for grouping and filtering
    consumerId string
    the id of the consumer to be configured with basic auth
    password string
    password to be used for basic auth
    username string
    username to be used for basic auth
    tags string[]
    A list of strings associated with the consumer basic auth for grouping and filtering
    consumer_id str
    the id of the consumer to be configured with basic auth
    password str
    password to be used for basic auth
    username str
    username to be used for basic auth
    tags Sequence[str]
    A list of strings associated with the consumer basic auth for grouping and filtering
    consumerId String
    the id of the consumer to be configured with basic auth
    password String
    password to be used for basic auth
    username String
    username to be used for basic auth
    tags List<String>
    A list of strings associated with the consumer basic auth for grouping and filtering

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ConsumerBasicAuth 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 ConsumerBasicAuth Resource

    Get an existing ConsumerBasicAuth 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?: ConsumerBasicAuthState, opts?: CustomResourceOptions): ConsumerBasicAuth
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            consumer_id: Optional[str] = None,
            password: Optional[str] = None,
            tags: Optional[Sequence[str]] = None,
            username: Optional[str] = None) -> ConsumerBasicAuth
    func GetConsumerBasicAuth(ctx *Context, name string, id IDInput, state *ConsumerBasicAuthState, opts ...ResourceOption) (*ConsumerBasicAuth, error)
    public static ConsumerBasicAuth Get(string name, Input<string> id, ConsumerBasicAuthState? state, CustomResourceOptions? opts = null)
    public static ConsumerBasicAuth get(String name, Output<String> id, ConsumerBasicAuthState 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 be configured with basic auth
    Password string
    password to be used for basic auth
    Tags List<string>
    A list of strings associated with the consumer basic auth for grouping and filtering
    Username string
    username to be used for basic auth
    ConsumerId string
    the id of the consumer to be configured with basic auth
    Password string
    password to be used for basic auth
    Tags []string
    A list of strings associated with the consumer basic auth for grouping and filtering
    Username string
    username to be used for basic auth
    consumerId String
    the id of the consumer to be configured with basic auth
    password String
    password to be used for basic auth
    tags List<String>
    A list of strings associated with the consumer basic auth for grouping and filtering
    username String
    username to be used for basic auth
    consumerId string
    the id of the consumer to be configured with basic auth
    password string
    password to be used for basic auth
    tags string[]
    A list of strings associated with the consumer basic auth for grouping and filtering
    username string
    username to be used for basic auth
    consumer_id str
    the id of the consumer to be configured with basic auth
    password str
    password to be used for basic auth
    tags Sequence[str]
    A list of strings associated with the consumer basic auth for grouping and filtering
    username str
    username to be used for basic auth
    consumerId String
    the id of the consumer to be configured with basic auth
    password String
    password to be used for basic auth
    tags List<String>
    A list of strings associated with the consumer basic auth for grouping and filtering
    username String
    username to be used for basic auth

    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