Class AppRoleBuilder


  • public final class AppRoleBuilder
    extends Object
    A builder for vault AppRole roles..
    Since:
    0.4.0
    Author:
    Stefan Kalscheuer
    • Constructor Detail

      • AppRoleBuilder

        public AppRoleBuilder​(String name)
        Construct AppRoleBuilder with only the role name set.
        Parameters:
        name - Role name
    • Method Detail

      • withId

        public AppRoleBuilder withId​(String id)
        Add custom role ID. (optional)
        Parameters:
        id - the ID
        Returns:
        self
      • withBindSecretID

        public AppRoleBuilder withBindSecretID​(Boolean bindSecretId)
        Set if role is bound to secret ID.
        Parameters:
        bindSecretId - the display name
        Returns:
        self
      • withSecretIdBoundCidrs

        public AppRoleBuilder withSecretIdBoundCidrs​(List<String> secretIdBoundCidrs)
        Set bound CIDR blocks.
        Parameters:
        secretIdBoundCidrs - List of CIDR blocks which can perform login
        Returns:
        self
        Since:
        0.8 replaces withBoundCidrList(List)
      • withCidrBlock

        public AppRoleBuilder withCidrBlock​(String cidrBlock)
        Add a CIDR block to list of bound blocks.
        Parameters:
        cidrBlock - the CIDR block
        Returns:
        self
      • withPolicies

        public AppRoleBuilder withPolicies​(List<String> policies)
        Add given policies.
        Parameters:
        policies - the policies
        Returns:
        self
      • withPolicy

        public AppRoleBuilder withPolicy​(String policy)
        Add a single policy.
        Parameters:
        policy - the policy
        Returns:
        self
      • withSecretIdNumUses

        public AppRoleBuilder withSecretIdNumUses​(Integer secredIdNumUses)
        Set number of uses for sectet IDs.
        Parameters:
        secredIdNumUses - the number of uses
        Returns:
        self
      • withSecretIdTtl

        public AppRoleBuilder withSecretIdTtl​(Integer secredIdTtl)
        Set default sectet ID TTL in seconds.
        Parameters:
        secredIdTtl - the TTL
        Returns:
        self
      • withTokenTtl

        public AppRoleBuilder withTokenTtl​(Integer tokenTtl)
        Set default token TTL in seconds.
        Parameters:
        tokenTtl - the TTL
        Returns:
        self
      • withTokenMaxTtl

        public AppRoleBuilder withTokenMaxTtl​(Integer tokenMaxTtl)
        Set maximum token TTL in seconds.
        Parameters:
        tokenMaxTtl - the TTL
        Returns:
        self
      • withPeriod

        public AppRoleBuilder withPeriod​(Integer period)
        Set renewal period for generated token in seconds.
        Parameters:
        period - period in seconds
        Returns:
        self
      • build

        public AppRole build()
        Build the AppRole role based on given parameters.
        Returns:
        the role