1. Packages
  2. Astra DB
  3. API Docs
  4. Token
Astra DB v1.0.42 published on Tuesday, Jun 6, 2023 by pulumiverse

astra.Token

Explore with Pulumi AI

astra.Token resource represents a token with a specific role assigned.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Astra = Pulumiverse.Astra;

return await Deployment.RunAsync(() => 
{
    var example = new Astra.Token("example", new()
    {
        Roles = new[]
        {
            "a8cd363d-5069-4a2b-86d8-0578139812ac",
        },
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-astra/sdk/go/astra"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := astra.NewToken(ctx, "example", &astra.TokenArgs{
			Roles: pulumi.StringArray{
				pulumi.String("a8cd363d-5069-4a2b-86d8-0578139812ac"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.astra.Token;
import com.pulumi.astra.TokenArgs;
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 example = new Token("example", TokenArgs.builder()        
            .roles("a8cd363d-5069-4a2b-86d8-0578139812ac")
            .build());

    }
}
Copy
import * as pulumi from "@pulumi/pulumi";
import * as astra from "@pulumi/astra";

const example = new astra.Token("example", {
    roles: ["a8cd363d-5069-4a2b-86d8-0578139812ac"],
});
Copy
import pulumi
import pulumiverse_astra as astra

example = astra.Token("example", roles=["a8cd363d-5069-4a2b-86d8-0578139812ac"])
Copy
resources:
  example:
    type: astra:Token
    properties:
      roles:
        - a8cd363d-5069-4a2b-86d8-0578139812ac
Copy

Create Token Resource

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

Constructor syntax

new Token(name: string, args: TokenArgs, opts?: CustomResourceOptions);
@overload
def Token(resource_name: str,
          args: TokenArgs,
          opts: Optional[ResourceOptions] = None)

@overload
def Token(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          roles: Optional[Sequence[str]] = None)
func NewToken(ctx *Context, name string, args TokenArgs, opts ...ResourceOption) (*Token, error)
public Token(string name, TokenArgs args, CustomResourceOptions? opts = null)
public Token(String name, TokenArgs args)
public Token(String name, TokenArgs args, CustomResourceOptions options)
type: astra:Token
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. TokenArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. TokenArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. TokenArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. TokenArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. TokenArgs
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 tokenResource = new Astra.Token("tokenResource", new()
{
    Roles = new[]
    {
        "string",
    },
});
Copy
example, err := astra.NewToken(ctx, "tokenResource", &astra.TokenArgs{
	Roles: pulumi.StringArray{
		pulumi.String("string"),
	},
})
Copy
var tokenResource = new Token("tokenResource", TokenArgs.builder()
    .roles("string")
    .build());
Copy
token_resource = astra.Token("tokenResource", roles=["string"])
Copy
const tokenResource = new astra.Token("tokenResource", {roles: ["string"]});
Copy
type: astra:Token
properties:
    roles:
        - string
Copy

Token Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Token resource accepts the following input properties:

Roles
This property is required.
Changes to this property will trigger replacement.
List<string>
List of Role IDs to be assigned to the generated token
Roles
This property is required.
Changes to this property will trigger replacement.
[]string
List of Role IDs to be assigned to the generated token
roles
This property is required.
Changes to this property will trigger replacement.
List<String>
List of Role IDs to be assigned to the generated token
roles
This property is required.
Changes to this property will trigger replacement.
string[]
List of Role IDs to be assigned to the generated token
roles
This property is required.
Changes to this property will trigger replacement.
Sequence[str]
List of Role IDs to be assigned to the generated token
roles
This property is required.
Changes to this property will trigger replacement.
List<String>
List of Role IDs to be assigned to the generated token

Outputs

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

AstraToken string
Token, use as auth bearer for API calls or as password in combination with the word token in cql
ClientId string
Client id, use as username in cql to connect
Id string
The provider-assigned unique ID for this managed resource.
Secret string
Secret, use as password in cql to connect
ClientId string
Client id, use as username in cql to connect
Id string
The provider-assigned unique ID for this managed resource.
Secret string
Secret, use as password in cql to connect
Token string
Token, use as auth bearer for API calls or as password in combination with the word token in cql
clientId String
Client id, use as username in cql to connect
id String
The provider-assigned unique ID for this managed resource.
secret String
Secret, use as password in cql to connect
token String
Token, use as auth bearer for API calls or as password in combination with the word token in cql
clientId string
Client id, use as username in cql to connect
id string
The provider-assigned unique ID for this managed resource.
secret string
Secret, use as password in cql to connect
token string
Token, use as auth bearer for API calls or as password in combination with the word token in cql
client_id str
Client id, use as username in cql to connect
id str
The provider-assigned unique ID for this managed resource.
secret str
Secret, use as password in cql to connect
token str
Token, use as auth bearer for API calls or as password in combination with the word token in cql
clientId String
Client id, use as username in cql to connect
id String
The provider-assigned unique ID for this managed resource.
secret String
Secret, use as password in cql to connect
token String
Token, use as auth bearer for API calls or as password in combination with the word token in cql

Look up Existing Token Resource

Get an existing Token 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?: TokenState, opts?: CustomResourceOptions): Token
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        client_id: Optional[str] = None,
        roles: Optional[Sequence[str]] = None,
        secret: Optional[str] = None,
        token: Optional[str] = None) -> Token
func GetToken(ctx *Context, name string, id IDInput, state *TokenState, opts ...ResourceOption) (*Token, error)
public static Token Get(string name, Input<string> id, TokenState? state, CustomResourceOptions? opts = null)
public static Token get(String name, Output<String> id, TokenState state, CustomResourceOptions options)
resources:  _:    type: astra:Token    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
AstraToken string
Token, use as auth bearer for API calls or as password in combination with the word token in cql
ClientId string
Client id, use as username in cql to connect
Roles Changes to this property will trigger replacement. List<string>
List of Role IDs to be assigned to the generated token
Secret string
Secret, use as password in cql to connect
ClientId string
Client id, use as username in cql to connect
Roles Changes to this property will trigger replacement. []string
List of Role IDs to be assigned to the generated token
Secret string
Secret, use as password in cql to connect
Token string
Token, use as auth bearer for API calls or as password in combination with the word token in cql
clientId String
Client id, use as username in cql to connect
roles Changes to this property will trigger replacement. List<String>
List of Role IDs to be assigned to the generated token
secret String
Secret, use as password in cql to connect
token String
Token, use as auth bearer for API calls or as password in combination with the word token in cql
clientId string
Client id, use as username in cql to connect
roles Changes to this property will trigger replacement. string[]
List of Role IDs to be assigned to the generated token
secret string
Secret, use as password in cql to connect
token string
Token, use as auth bearer for API calls or as password in combination with the word token in cql
client_id str
Client id, use as username in cql to connect
roles Changes to this property will trigger replacement. Sequence[str]
List of Role IDs to be assigned to the generated token
secret str
Secret, use as password in cql to connect
token str
Token, use as auth bearer for API calls or as password in combination with the word token in cql
clientId String
Client id, use as username in cql to connect
roles Changes to this property will trigger replacement. List<String>
List of Role IDs to be assigned to the generated token
secret String
Secret, use as password in cql to connect
token String
Token, use as auth bearer for API calls or as password in combination with the word token in cql

Import

 $ pulumi import astra:index/token:Token example client-secret
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
astra pulumiverse/pulumi-astra
License
Apache-2.0
Notes
This Pulumi package is based on the astra Terraform Provider.