Class AppRole.Builder

java.lang.Object
de.stklcode.jvault.connector.model.AppRole.Builder
Enclosing class:
AppRole

public static final class AppRole.Builder extends Object
A builder for vault AppRole roles..
Since:
0.4.0, 0.9 Moved into subclass of AppRole.
Author:
Stefan Kalscheuer
  • Constructor Details

    • Builder

      public Builder(String name)
      Construct AppRole.Builder with only the role name set.
      Parameters:
      name - Role name
  • Method Details

    • withName

      public AppRole.Builder withName(String name)
      Add role name.
      Parameters:
      name - Role name
      Returns:
      self
    • withId

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

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

      public AppRole.Builder withBindSecretID()
      Bind role to secret ID. Convenience method for withBindSecretID(Boolean)
      Returns:
      self
    • withoutBindSecretID

      public AppRole.Builder withoutBindSecretID()
      Do not bind role to secret ID. Convenience method for withBindSecretID(Boolean)
      Returns:
      self
    • withSecretIdBoundCidrs

      public AppRole.Builder 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)
    • withSecretBoundCidr

      public AppRole.Builder withSecretBoundCidr(String secretBoundCidr)
      Add a CIDR block to list of bound blocks for secret.
      Parameters:
      secretBoundCidr - the CIDR block
      Returns:
      self
      Since:
      0.9
    • withTokenPolicies

      public AppRole.Builder withTokenPolicies(List<String> tokenPolicies)
      Add given policies.
      Parameters:
      tokenPolicies - the token policies
      Returns:
      self
      Since:
      0.9
    • withTokenPolicy

      public AppRole.Builder withTokenPolicy(String tokenPolicy)
      Add a single policy.
      Parameters:
      tokenPolicy - the token policy
      Returns:
      self
      Since:
      0.9
    • withSecretIdNumUses

      public AppRole.Builder withSecretIdNumUses(Integer secretIdNumUses)
      Set number of uses for sectet IDs.
      Parameters:
      secretIdNumUses - the number of uses
      Returns:
      self
    • withSecretIdTtl

      public AppRole.Builder withSecretIdTtl(Integer secretIdTtl)
      Set default sectet ID TTL in seconds.
      Parameters:
      secretIdTtl - the TTL
      Returns:
      self
    • withEnableLocalSecretIds

      public AppRole.Builder withEnableLocalSecretIds(Boolean enableLocalSecretIds)
      Enable or disable local secret IDs.
      Parameters:
      enableLocalSecretIds - Enable local secret IDs?
      Returns:
      self
      Since:
      0.9
    • withTokenTtl

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

      public AppRole.Builder withTokenMaxTtl(Integer tokenMaxTtl)
      Set maximum token TTL in seconds.
      Parameters:
      tokenMaxTtl - the TTL
      Returns:
      self
    • withTokenBoundCidrs

      public AppRole.Builder withTokenBoundCidrs(List<String> tokenBoundCidrs)
      Set bound CIDR blocks for associated tokens.
      Parameters:
      tokenBoundCidrs - List of CIDR blocks which can perform login
      Returns:
      self
      Since:
      0.9
    • withTokenBoundCidr

      public AppRole.Builder withTokenBoundCidr(String tokenBoundCidr)
      Add a CIDR block to list of bound blocks for token.
      Parameters:
      tokenBoundCidr - the CIDR block
      Returns:
      self
      Since:
      0.9
    • withTokenExplicitMaxTtl

      public AppRole.Builder withTokenExplicitMaxTtl(Integer tokenExplicitMaxTtl)
      Set explicit maximum token TTL in seconds.
      Parameters:
      tokenExplicitMaxTtl - the TTL
      Returns:
      self
    • withTokenNoDefaultPolicy

      public AppRole.Builder withTokenNoDefaultPolicy(Boolean tokenNoDefaultPolicy)
      Enable or disable default policy for generated token.
      Parameters:
      tokenNoDefaultPolicy - Enable default policy for token?
      Returns:
      self
      Since:
      0.9
    • withTokenNumUses

      public AppRole.Builder withTokenNumUses(Integer tokenNumUses)
      Set number of uses for generated tokens.
      Parameters:
      tokenNumUses - number of uses for tokens
      Returns:
      self
      Since:
      0.9
    • withTokenPeriod

      public AppRole.Builder withTokenPeriod(Integer tokenPeriod)
      Set renewal period for generated token in seconds.
      Parameters:
      tokenPeriod - period in seconds
      Returns:
      self
      Since:
      0.9
    • withTokenType

      public AppRole.Builder withTokenType(Token.Type tokenType)
      Set type of generated token.
      Parameters:
      tokenType - token type
      Returns:
      self
      Since:
      0.9
    • build

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