1. Packages
  2. Artifactory
  3. API Docs
  4. AccessToken
artifactory v6.4.2 published on Thursday, Mar 28, 2024 by Pulumi

artifactory.AccessToken

Explore with Pulumi AI

artifactory logo
artifactory v6.4.2 published on Thursday, Mar 28, 2024 by Pulumi

    !> Warning: This resource is being deprecated and replaced by artifactory.ScopedToken since v6.8.0.

    Provides an Artifactory Access Token resource. This can be used to create and manage Artifactory Access Tokens.

    Note: Access Tokens will be stored in the raw state as plain-text. Read more about sensitive data in state.

    Example Usage

    S

    Create a new Artifactory Access Token for an existing user

    import * as pulumi from "@pulumi/pulumi";
    import * as artifactory from "@pulumi/artifactory";
    
    const exisingUser = new artifactory.AccessToken("exisingUser", {
        endDateRelative: "5m",
        username: "existing-user",
    });
    
    import pulumi
    import pulumi_artifactory as artifactory
    
    exising_user = artifactory.AccessToken("exisingUser",
        end_date_relative="5m",
        username="existing-user")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := artifactory.NewAccessToken(ctx, "exisingUser", &artifactory.AccessTokenArgs{
    			EndDateRelative: pulumi.String("5m"),
    			Username:        pulumi.String("existing-user"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Artifactory = Pulumi.Artifactory;
    
    return await Deployment.RunAsync(() => 
    {
        var exisingUser = new Artifactory.AccessToken("exisingUser", new()
        {
            EndDateRelative = "5m",
            Username = "existing-user",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.artifactory.AccessToken;
    import com.pulumi.artifactory.AccessTokenArgs;
    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 exisingUser = new AccessToken("exisingUser", AccessTokenArgs.builder()        
                .endDateRelative("5m")
                .username("existing-user")
                .build());
    
        }
    }
    
    resources:
      exisingUser:
        type: artifactory:AccessToken
        properties:
          endDateRelative: 5m
          username: existing-user
    

    Note: This assumes that the user existing-user has already been created in Artifactory by different means, i.e. manually or in a separate pulumi up.

    Create a new Artifactory User and Access token

    import * as pulumi from "@pulumi/pulumi";
    import * as artifactory from "@pulumi/artifactory";
    
    const newUserUser = new artifactory.User("newUserUser", {
        email: "new_user@somewhere.com",
        groups: ["readers"],
    });
    const newUserAccessToken = new artifactory.AccessToken("newUserAccessToken", {
        username: newUserUser.name,
        endDateRelative: "5m",
    });
    
    import pulumi
    import pulumi_artifactory as artifactory
    
    new_user_user = artifactory.User("newUserUser",
        email="new_user@somewhere.com",
        groups=["readers"])
    new_user_access_token = artifactory.AccessToken("newUserAccessToken",
        username=new_user_user.name,
        end_date_relative="5m")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		newUserUser, err := artifactory.NewUser(ctx, "newUserUser", &artifactory.UserArgs{
    			Email: pulumi.String("new_user@somewhere.com"),
    			Groups: pulumi.StringArray{
    				pulumi.String("readers"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = artifactory.NewAccessToken(ctx, "newUserAccessToken", &artifactory.AccessTokenArgs{
    			Username:        newUserUser.Name,
    			EndDateRelative: pulumi.String("5m"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Artifactory = Pulumi.Artifactory;
    
    return await Deployment.RunAsync(() => 
    {
        var newUserUser = new Artifactory.User("newUserUser", new()
        {
            Email = "new_user@somewhere.com",
            Groups = new[]
            {
                "readers",
            },
        });
    
        var newUserAccessToken = new Artifactory.AccessToken("newUserAccessToken", new()
        {
            Username = newUserUser.Name,
            EndDateRelative = "5m",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.artifactory.User;
    import com.pulumi.artifactory.UserArgs;
    import com.pulumi.artifactory.AccessToken;
    import com.pulumi.artifactory.AccessTokenArgs;
    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 newUserUser = new User("newUserUser", UserArgs.builder()        
                .email("new_user@somewhere.com")
                .groups("readers")
                .build());
    
            var newUserAccessToken = new AccessToken("newUserAccessToken", AccessTokenArgs.builder()        
                .username(newUserUser.name())
                .endDateRelative("5m")
                .build());
    
        }
    }
    
    resources:
      newUserUser:
        type: artifactory:User
        properties:
          email: new_user@somewhere.com
          groups:
            - readers
      newUserAccessToken:
        type: artifactory:AccessToken
        properties:
          username: ${newUserUser.name}
          endDateRelative: 5m
    

    Creates a new token for groups

    This creates a transient user called temporary-user.

    import * as pulumi from "@pulumi/pulumi";
    import * as artifactory from "@pulumi/artifactory";
    
    const temporaryUser = new artifactory.AccessToken("temporaryUser", {
        endDateRelative: "1h",
        groups: ["readers"],
        username: "temporary-user",
    });
    
    import pulumi
    import pulumi_artifactory as artifactory
    
    temporary_user = artifactory.AccessToken("temporaryUser",
        end_date_relative="1h",
        groups=["readers"],
        username="temporary-user")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := artifactory.NewAccessToken(ctx, "temporaryUser", &artifactory.AccessTokenArgs{
    			EndDateRelative: pulumi.String("1h"),
    			Groups: pulumi.StringArray{
    				pulumi.String("readers"),
    			},
    			Username: pulumi.String("temporary-user"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Artifactory = Pulumi.Artifactory;
    
    return await Deployment.RunAsync(() => 
    {
        var temporaryUser = new Artifactory.AccessToken("temporaryUser", new()
        {
            EndDateRelative = "1h",
            Groups = new[]
            {
                "readers",
            },
            Username = "temporary-user",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.artifactory.AccessToken;
    import com.pulumi.artifactory.AccessTokenArgs;
    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 temporaryUser = new AccessToken("temporaryUser", AccessTokenArgs.builder()        
                .endDateRelative("1h")
                .groups("readers")
                .username("temporary-user")
                .build());
    
        }
    }
    
    resources:
      temporaryUser:
        type: artifactory:AccessToken
        properties:
          endDateRelative: 1h
          groups:
            - readers
          username: temporary-user
    

    Create token with no expiry

    import * as pulumi from "@pulumi/pulumi";
    import * as artifactory from "@pulumi/artifactory";
    
    const noExpiry = new artifactory.AccessToken("noExpiry", {
        endDateRelative: "0s",
        username: "existing-user",
    });
    
    import pulumi
    import pulumi_artifactory as artifactory
    
    no_expiry = artifactory.AccessToken("noExpiry",
        end_date_relative="0s",
        username="existing-user")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := artifactory.NewAccessToken(ctx, "noExpiry", &artifactory.AccessTokenArgs{
    			EndDateRelative: pulumi.String("0s"),
    			Username:        pulumi.String("existing-user"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Artifactory = Pulumi.Artifactory;
    
    return await Deployment.RunAsync(() => 
    {
        var noExpiry = new Artifactory.AccessToken("noExpiry", new()
        {
            EndDateRelative = "0s",
            Username = "existing-user",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.artifactory.AccessToken;
    import com.pulumi.artifactory.AccessTokenArgs;
    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 noExpiry = new AccessToken("noExpiry", AccessTokenArgs.builder()        
                .endDateRelative("0s")
                .username("existing-user")
                .build());
    
        }
    }
    
    resources:
      noExpiry:
        type: artifactory:AccessToken
        properties:
          endDateRelative: 0s
          username: existing-user
    

    Creates a refreshable token

    import * as pulumi from "@pulumi/pulumi";
    import * as artifactory from "@pulumi/artifactory";
    
    const refreshable = new artifactory.AccessToken("refreshable", {
        endDateRelative: "1m",
        groups: ["readers"],
        refreshable: true,
        username: "refreshable",
    });
    
    import pulumi
    import pulumi_artifactory as artifactory
    
    refreshable = artifactory.AccessToken("refreshable",
        end_date_relative="1m",
        groups=["readers"],
        refreshable=True,
        username="refreshable")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := artifactory.NewAccessToken(ctx, "refreshable", &artifactory.AccessTokenArgs{
    			EndDateRelative: pulumi.String("1m"),
    			Groups: pulumi.StringArray{
    				pulumi.String("readers"),
    			},
    			Refreshable: pulumi.Bool(true),
    			Username:    pulumi.String("refreshable"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Artifactory = Pulumi.Artifactory;
    
    return await Deployment.RunAsync(() => 
    {
        var refreshable = new Artifactory.AccessToken("refreshable", new()
        {
            EndDateRelative = "1m",
            Groups = new[]
            {
                "readers",
            },
            Refreshable = true,
            Username = "refreshable",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.artifactory.AccessToken;
    import com.pulumi.artifactory.AccessTokenArgs;
    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 refreshable = new AccessToken("refreshable", AccessTokenArgs.builder()        
                .endDateRelative("1m")
                .groups("readers")
                .refreshable(true)
                .username("refreshable")
                .build());
    
        }
    }
    
    resources:
      refreshable:
        type: artifactory:AccessToken
        properties:
          endDateRelative: 1m
          groups:
            - readers
          refreshable: true
          username: refreshable
    

    Creates an administrator token

    import * as pulumi from "@pulumi/pulumi";
    import * as artifactory from "@pulumi/artifactory";
    
    const admin = new artifactory.AccessToken("admin", {
        adminToken: {
            instanceId: "<instance id>",
        },
        endDateRelative: "1m",
        username: "admin",
    });
    
    import pulumi
    import pulumi_artifactory as artifactory
    
    admin = artifactory.AccessToken("admin",
        admin_token=artifactory.AccessTokenAdminTokenArgs(
            instance_id="<instance id>",
        ),
        end_date_relative="1m",
        username="admin")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := artifactory.NewAccessToken(ctx, "admin", &artifactory.AccessTokenArgs{
    			AdminToken: &artifactory.AccessTokenAdminTokenArgs{
    				InstanceId: pulumi.String("<instance id>"),
    			},
    			EndDateRelative: pulumi.String("1m"),
    			Username:        pulumi.String("admin"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Artifactory = Pulumi.Artifactory;
    
    return await Deployment.RunAsync(() => 
    {
        var admin = new Artifactory.AccessToken("admin", new()
        {
            AdminToken = new Artifactory.Inputs.AccessTokenAdminTokenArgs
            {
                InstanceId = "<instance id>",
            },
            EndDateRelative = "1m",
            Username = "admin",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.artifactory.AccessToken;
    import com.pulumi.artifactory.AccessTokenArgs;
    import com.pulumi.artifactory.inputs.AccessTokenAdminTokenArgs;
    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 admin = new AccessToken("admin", AccessTokenArgs.builder()        
                .adminToken(AccessTokenAdminTokenArgs.builder()
                    .instanceId("<instance id>")
                    .build())
                .endDateRelative("1m")
                .username("admin")
                .build());
    
        }
    }
    
    resources:
      admin:
        type: artifactory:AccessToken
        properties:
          adminToken:
            instanceId: <instance id>
          endDateRelative: 1m
          username: admin
    

    Creates a token with an audience

    import * as pulumi from "@pulumi/pulumi";
    import * as artifactory from "@pulumi/artifactory";
    
    const audience = new artifactory.AccessToken("audience", {
        audience: "jfrt@*",
        endDateRelative: "1m",
        refreshable: true,
        username: "audience",
    });
    
    import pulumi
    import pulumi_artifactory as artifactory
    
    audience = artifactory.AccessToken("audience",
        audience="jfrt@*",
        end_date_relative="1m",
        refreshable=True,
        username="audience")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := artifactory.NewAccessToken(ctx, "audience", &artifactory.AccessTokenArgs{
    			Audience:        pulumi.String("jfrt@*"),
    			EndDateRelative: pulumi.String("1m"),
    			Refreshable:     pulumi.Bool(true),
    			Username:        pulumi.String("audience"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Artifactory = Pulumi.Artifactory;
    
    return await Deployment.RunAsync(() => 
    {
        var audience = new Artifactory.AccessToken("audience", new()
        {
            Audience = "jfrt@*",
            EndDateRelative = "1m",
            Refreshable = true,
            Username = "audience",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.artifactory.AccessToken;
    import com.pulumi.artifactory.AccessTokenArgs;
    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 audience = new AccessToken("audience", AccessTokenArgs.builder()        
                .audience("jfrt@*")
                .endDateRelative("1m")
                .refreshable(true)
                .username("audience")
                .build());
    
        }
    }
    
    resources:
      audience:
        type: artifactory:AccessToken
        properties:
          audience: jfrt@*
          endDateRelative: 1m
          refreshable: true
          username: audience
    

    Creates a token with a fixed end date

    import * as pulumi from "@pulumi/pulumi";
    import * as artifactory from "@pulumi/artifactory";
    
    const fixeddate = new artifactory.AccessToken("fixeddate", {
        endDate: "2018-01-01T01:02:03Z",
        groups: ["readers"],
        username: "fixeddate",
    });
    
    import pulumi
    import pulumi_artifactory as artifactory
    
    fixeddate = artifactory.AccessToken("fixeddate",
        end_date="2018-01-01T01:02:03Z",
        groups=["readers"],
        username="fixeddate")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := artifactory.NewAccessToken(ctx, "fixeddate", &artifactory.AccessTokenArgs{
    			EndDate: pulumi.String("2018-01-01T01:02:03Z"),
    			Groups: pulumi.StringArray{
    				pulumi.String("readers"),
    			},
    			Username: pulumi.String("fixeddate"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Artifactory = Pulumi.Artifactory;
    
    return await Deployment.RunAsync(() => 
    {
        var fixeddate = new Artifactory.AccessToken("fixeddate", new()
        {
            EndDate = "2018-01-01T01:02:03Z",
            Groups = new[]
            {
                "readers",
            },
            Username = "fixeddate",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.artifactory.AccessToken;
    import com.pulumi.artifactory.AccessTokenArgs;
    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 fixeddate = new AccessToken("fixeddate", AccessTokenArgs.builder()        
                .endDate("2018-01-01T01:02:03Z")
                .groups("readers")
                .username("fixeddate")
                .build());
    
        }
    }
    
    resources:
      fixeddate:
        type: artifactory:AccessToken
        properties:
          endDate: 2018-01-01T01:02:03Z
          groups:
            - readers
          username: fixeddate
    

    Rotate token after it expires

    This example will generate a token that will expire in 1 hour.

    If pulumi up is run before 1 hour, nothing changes. One an hour has passed, pulumi up will generate a new token.

    import * as pulumi from "@pulumi/pulumi";
    import * as artifactory from "@pulumi/artifactory";
    import * as time from "@pulumiverse/time";
    
    const nowPlus1Hours = new time.Rotating("nowPlus1Hours", {rotationHours: 1});
    const rotating = new artifactory.AccessToken("rotating", {
        username: "rotating",
        endDate: time_rotating.now_plus_1_hour.rotation_rfc3339,
        groups: ["readers"],
    });
    
    import pulumi
    import pulumi_artifactory as artifactory
    import pulumiverse_time as time
    
    now_plus1_hours = time.Rotating("nowPlus1Hours", rotation_hours=1)
    rotating = artifactory.AccessToken("rotating",
        username="rotating",
        end_date=time_rotating["now_plus_1_hour"]["rotation_rfc3339"],
        groups=["readers"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-artifactory/sdk/v6/go/artifactory"
    	"github.com/pulumi/pulumi-time/sdk/go/time"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := time.NewRotating(ctx, "nowPlus1Hours", &time.RotatingArgs{
    			RotationHours: pulumi.Int(1),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = artifactory.NewAccessToken(ctx, "rotating", &artifactory.AccessTokenArgs{
    			Username: pulumi.String("rotating"),
    			EndDate:  pulumi.Any(time_rotating.Now_plus_1_hour.Rotation_rfc3339),
    			Groups: pulumi.StringArray{
    				pulumi.String("readers"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Artifactory = Pulumi.Artifactory;
    using Time = Pulumiverse.Time;
    
    return await Deployment.RunAsync(() => 
    {
        var nowPlus1Hours = new Time.Rotating("nowPlus1Hours", new()
        {
            RotationHours = 1,
        });
    
        var rotating = new Artifactory.AccessToken("rotating", new()
        {
            Username = "rotating",
            EndDate = time_rotating.Now_plus_1_hour.Rotation_rfc3339,
            Groups = new[]
            {
                "readers",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.time.Rotating;
    import com.pulumi.time.RotatingArgs;
    import com.pulumi.artifactory.AccessToken;
    import com.pulumi.artifactory.AccessTokenArgs;
    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 nowPlus1Hours = new Rotating("nowPlus1Hours", RotatingArgs.builder()        
                .rotationHours("1")
                .build());
    
            var rotating = new AccessToken("rotating", AccessTokenArgs.builder()        
                .username("rotating")
                .endDate(time_rotating.now_plus_1_hour().rotation_rfc3339())
                .groups("readers")
                .build());
    
        }
    }
    
    resources:
      nowPlus1Hours:
        type: time:Rotating
        properties:
          rotationHours: '1'
      rotating:
        type: artifactory:AccessToken
        properties:
          username: rotating
          # the end_date is set to now + 1 hours
          endDate: ${time_rotating.now_plus_1_hour.rotation_rfc3339}
          groups:
            - readers
    

    Create AccessToken Resource

    new AccessToken(name: string, args: AccessTokenArgs, opts?: CustomResourceOptions);
    @overload
    def AccessToken(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    admin_token: Optional[AccessTokenAdminTokenArgs] = None,
                    audience: Optional[str] = None,
                    end_date: Optional[str] = None,
                    end_date_relative: Optional[str] = None,
                    groups: Optional[Sequence[str]] = None,
                    refreshable: Optional[bool] = None,
                    username: Optional[str] = None)
    @overload
    def AccessToken(resource_name: str,
                    args: AccessTokenArgs,
                    opts: Optional[ResourceOptions] = None)
    func NewAccessToken(ctx *Context, name string, args AccessTokenArgs, opts ...ResourceOption) (*AccessToken, error)
    public AccessToken(string name, AccessTokenArgs args, CustomResourceOptions? opts = null)
    public AccessToken(String name, AccessTokenArgs args)
    public AccessToken(String name, AccessTokenArgs args, CustomResourceOptions options)
    
    type: artifactory:AccessToken
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args AccessTokenArgs
    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 AccessTokenArgs
    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 AccessTokenArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AccessTokenArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AccessTokenArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    Username string
    (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require groups to be set.
    AdminToken AccessTokenAdminToken
    (Optional) Specify the instance_id in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin. admin_token cannot be specified with groups.
    Audience string
    (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set "jfrt@*" so the token to be accepted by all Artifactory instances.
    EndDate string
    (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g. 2018-01-01T01:02:03Z).
    EndDateRelative string
    (Optional) A relative duration for which the token is valid until, for example 240h (10 days) or 2400h30m. Valid time units are "s", "m", "h".
    Groups List<string>
    (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify ["*"] for all groups that the user belongs to. groups cannot be specified with admin_token.
    Refreshable bool
    (Optional) Is this token refreshable? Defaults to false
    Username string
    (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require groups to be set.
    AdminToken AccessTokenAdminTokenArgs
    (Optional) Specify the instance_id in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin. admin_token cannot be specified with groups.
    Audience string
    (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set "jfrt@*" so the token to be accepted by all Artifactory instances.
    EndDate string
    (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g. 2018-01-01T01:02:03Z).
    EndDateRelative string
    (Optional) A relative duration for which the token is valid until, for example 240h (10 days) or 2400h30m. Valid time units are "s", "m", "h".
    Groups []string
    (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify ["*"] for all groups that the user belongs to. groups cannot be specified with admin_token.
    Refreshable bool
    (Optional) Is this token refreshable? Defaults to false
    username String
    (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require groups to be set.
    adminToken AccessTokenAdminToken
    (Optional) Specify the instance_id in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin. admin_token cannot be specified with groups.
    audience String
    (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set "jfrt@*" so the token to be accepted by all Artifactory instances.
    endDate String
    (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g. 2018-01-01T01:02:03Z).
    endDateRelative String
    (Optional) A relative duration for which the token is valid until, for example 240h (10 days) or 2400h30m. Valid time units are "s", "m", "h".
    groups List<String>
    (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify ["*"] for all groups that the user belongs to. groups cannot be specified with admin_token.
    refreshable Boolean
    (Optional) Is this token refreshable? Defaults to false
    username string
    (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require groups to be set.
    adminToken AccessTokenAdminToken
    (Optional) Specify the instance_id in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin. admin_token cannot be specified with groups.
    audience string
    (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set "jfrt@*" so the token to be accepted by all Artifactory instances.
    endDate string
    (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g. 2018-01-01T01:02:03Z).
    endDateRelative string
    (Optional) A relative duration for which the token is valid until, for example 240h (10 days) or 2400h30m. Valid time units are "s", "m", "h".
    groups string[]
    (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify ["*"] for all groups that the user belongs to. groups cannot be specified with admin_token.
    refreshable boolean
    (Optional) Is this token refreshable? Defaults to false
    username str
    (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require groups to be set.
    admin_token AccessTokenAdminTokenArgs
    (Optional) Specify the instance_id in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin. admin_token cannot be specified with groups.
    audience str
    (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set "jfrt@*" so the token to be accepted by all Artifactory instances.
    end_date str
    (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g. 2018-01-01T01:02:03Z).
    end_date_relative str
    (Optional) A relative duration for which the token is valid until, for example 240h (10 days) or 2400h30m. Valid time units are "s", "m", "h".
    groups Sequence[str]
    (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify ["*"] for all groups that the user belongs to. groups cannot be specified with admin_token.
    refreshable bool
    (Optional) Is this token refreshable? Defaults to false
    username String
    (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require groups to be set.
    adminToken Property Map
    (Optional) Specify the instance_id in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin. admin_token cannot be specified with groups.
    audience String
    (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set "jfrt@*" so the token to be accepted by all Artifactory instances.
    endDate String
    (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g. 2018-01-01T01:02:03Z).
    endDateRelative String
    (Optional) A relative duration for which the token is valid until, for example 240h (10 days) or 2400h30m. Valid time units are "s", "m", "h".
    groups List<String>
    (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify ["*"] for all groups that the user belongs to. groups cannot be specified with admin_token.
    refreshable Boolean
    (Optional) Is this token refreshable? Defaults to false

    Outputs

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

    Details string
    Returns the access token to authenciate to Artifactory
    Id string
    The provider-assigned unique ID for this managed resource.
    RefreshToken string
    Returns the refresh token when refreshable is true, or an empty string when refreshable is false.
    AccessToken string
    Returns the access token to authenciate to Artifactory
    Id string
    The provider-assigned unique ID for this managed resource.
    RefreshToken string
    Returns the refresh token when refreshable is true, or an empty string when refreshable is false.
    accessToken String
    Returns the access token to authenciate to Artifactory
    id String
    The provider-assigned unique ID for this managed resource.
    refreshToken String
    Returns the refresh token when refreshable is true, or an empty string when refreshable is false.
    accessToken string
    Returns the access token to authenciate to Artifactory
    id string
    The provider-assigned unique ID for this managed resource.
    refreshToken string
    Returns the refresh token when refreshable is true, or an empty string when refreshable is false.
    access_token str
    Returns the access token to authenciate to Artifactory
    id str
    The provider-assigned unique ID for this managed resource.
    refresh_token str
    Returns the refresh token when refreshable is true, or an empty string when refreshable is false.
    accessToken String
    Returns the access token to authenciate to Artifactory
    id String
    The provider-assigned unique ID for this managed resource.
    refreshToken String
    Returns the refresh token when refreshable is true, or an empty string when refreshable is false.

    Look up Existing AccessToken Resource

    Get an existing AccessToken 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?: AccessTokenState, opts?: CustomResourceOptions): AccessToken
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            access_token: Optional[str] = None,
            admin_token: Optional[AccessTokenAdminTokenArgs] = None,
            audience: Optional[str] = None,
            end_date: Optional[str] = None,
            end_date_relative: Optional[str] = None,
            groups: Optional[Sequence[str]] = None,
            refresh_token: Optional[str] = None,
            refreshable: Optional[bool] = None,
            username: Optional[str] = None) -> AccessToken
    func GetAccessToken(ctx *Context, name string, id IDInput, state *AccessTokenState, opts ...ResourceOption) (*AccessToken, error)
    public static AccessToken Get(string name, Input<string> id, AccessTokenState? state, CustomResourceOptions? opts = null)
    public static AccessToken get(String name, Output<String> id, AccessTokenState 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:
    AdminToken AccessTokenAdminToken
    (Optional) Specify the instance_id in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin. admin_token cannot be specified with groups.
    Audience string
    (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set "jfrt@*" so the token to be accepted by all Artifactory instances.
    Details string
    Returns the access token to authenciate to Artifactory
    EndDate string
    (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g. 2018-01-01T01:02:03Z).
    EndDateRelative string
    (Optional) A relative duration for which the token is valid until, for example 240h (10 days) or 2400h30m. Valid time units are "s", "m", "h".
    Groups List<string>
    (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify ["*"] for all groups that the user belongs to. groups cannot be specified with admin_token.
    RefreshToken string
    Returns the refresh token when refreshable is true, or an empty string when refreshable is false.
    Refreshable bool
    (Optional) Is this token refreshable? Defaults to false
    Username string
    (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require groups to be set.
    AccessToken string
    Returns the access token to authenciate to Artifactory
    AdminToken AccessTokenAdminTokenArgs
    (Optional) Specify the instance_id in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin. admin_token cannot be specified with groups.
    Audience string
    (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set "jfrt@*" so the token to be accepted by all Artifactory instances.
    EndDate string
    (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g. 2018-01-01T01:02:03Z).
    EndDateRelative string
    (Optional) A relative duration for which the token is valid until, for example 240h (10 days) or 2400h30m. Valid time units are "s", "m", "h".
    Groups []string
    (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify ["*"] for all groups that the user belongs to. groups cannot be specified with admin_token.
    RefreshToken string
    Returns the refresh token when refreshable is true, or an empty string when refreshable is false.
    Refreshable bool
    (Optional) Is this token refreshable? Defaults to false
    Username string
    (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require groups to be set.
    accessToken String
    Returns the access token to authenciate to Artifactory
    adminToken AccessTokenAdminToken
    (Optional) Specify the instance_id in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin. admin_token cannot be specified with groups.
    audience String
    (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set "jfrt@*" so the token to be accepted by all Artifactory instances.
    endDate String
    (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g. 2018-01-01T01:02:03Z).
    endDateRelative String
    (Optional) A relative duration for which the token is valid until, for example 240h (10 days) or 2400h30m. Valid time units are "s", "m", "h".
    groups List<String>
    (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify ["*"] for all groups that the user belongs to. groups cannot be specified with admin_token.
    refreshToken String
    Returns the refresh token when refreshable is true, or an empty string when refreshable is false.
    refreshable Boolean
    (Optional) Is this token refreshable? Defaults to false
    username String
    (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require groups to be set.
    accessToken string
    Returns the access token to authenciate to Artifactory
    adminToken AccessTokenAdminToken
    (Optional) Specify the instance_id in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin. admin_token cannot be specified with groups.
    audience string
    (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set "jfrt@*" so the token to be accepted by all Artifactory instances.
    endDate string
    (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g. 2018-01-01T01:02:03Z).
    endDateRelative string
    (Optional) A relative duration for which the token is valid until, for example 240h (10 days) or 2400h30m. Valid time units are "s", "m", "h".
    groups string[]
    (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify ["*"] for all groups that the user belongs to. groups cannot be specified with admin_token.
    refreshToken string
    Returns the refresh token when refreshable is true, or an empty string when refreshable is false.
    refreshable boolean
    (Optional) Is this token refreshable? Defaults to false
    username string
    (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require groups to be set.
    access_token str
    Returns the access token to authenciate to Artifactory
    admin_token AccessTokenAdminTokenArgs
    (Optional) Specify the instance_id in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin. admin_token cannot be specified with groups.
    audience str
    (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set "jfrt@*" so the token to be accepted by all Artifactory instances.
    end_date str
    (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g. 2018-01-01T01:02:03Z).
    end_date_relative str
    (Optional) A relative duration for which the token is valid until, for example 240h (10 days) or 2400h30m. Valid time units are "s", "m", "h".
    groups Sequence[str]
    (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify ["*"] for all groups that the user belongs to. groups cannot be specified with admin_token.
    refresh_token str
    Returns the refresh token when refreshable is true, or an empty string when refreshable is false.
    refreshable bool
    (Optional) Is this token refreshable? Defaults to false
    username str
    (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require groups to be set.
    accessToken String
    Returns the access token to authenciate to Artifactory
    adminToken Property Map
    (Optional) Specify the instance_id in this block to grant this token admin privileges. This can only be created when the authenticated user is an admin. admin_token cannot be specified with groups.
    audience String
    (Optional) A space-separate list of the other Artifactory instances or services that should accept this token identified by their Artifactory Service IDs. You may set "jfrt@*" so the token to be accepted by all Artifactory instances.
    endDate String
    (Optional) The end date which the token is valid until, formatted as a RFC3339 date string (e.g. 2018-01-01T01:02:03Z).
    endDateRelative String
    (Optional) A relative duration for which the token is valid until, for example 240h (10 days) or 2400h30m. Valid time units are "s", "m", "h".
    groups List<String>
    (Optional) List of groups. The token is granted access based on the permissions of the groups. Specify ["*"] for all groups that the user belongs to. groups cannot be specified with admin_token.
    refreshToken String
    Returns the refresh token when refreshable is true, or an empty string when refreshable is false.
    refreshable Boolean
    (Optional) Is this token refreshable? Defaults to false
    username String
    (Required) The username or subject for the token. A non-admin can only specify their own username. Admins can specify any existing username, or a new name for a temporary token. Temporary tokens require groups to be set.

    Supporting Types

    AccessTokenAdminToken, AccessTokenAdminTokenArgs

    InstanceId string
    InstanceId string
    instanceId String
    instanceId string
    instanceId String

    Package Details

    Repository
    artifactory pulumi/pulumi-artifactory
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the artifactory Terraform Provider.
    artifactory logo
    artifactory v6.4.2 published on Thursday, Mar 28, 2024 by Pulumi