Class Session.Builder

  • Enclosing class:
    Session

    public static class Session.Builder
    extends java.lang.Object
    A helper class to help to build the Session for snmp
     
     import com.santaba.agent.groovyapi.snmp.Session
    
     Session.Builder builder = Session.Builder.newBuilder()
     Session session = builder.withHost("XXXYourHost").withVersion("v2c")
             // ... withYYY other methods to set more properties
             .build()
    
     // use it
     println session.get("1.3.4.5")
     
     
    • Method Detail

      • withProps

        public Session.Builder withProps​(java.util.Map<java.lang.String,​java.lang.String> otherProps)
        inject more properties
        Parameters:
        otherProps - a map with key and value like snmp.authToken ....
        Returns:
      • withVersion

        public Session.Builder withVersion​(java.lang.String version)
      • withCommunity

        public Session.Builder withCommunity​(java.lang.String community)
      • withSecurity

        public Session.Builder withSecurity​(java.lang.String security)
      • withAuthProtocol

        public Session.Builder withAuthProtocol​(java.lang.String authProtocol)
      • withAuthToken

        public Session.Builder withAuthToken​(java.lang.String authToken)
      • withPrivProtocol

        public Session.Builder withPrivProtocol​(java.lang.String privProtocol)
      • withPrivToken

        public Session.Builder withPrivToken​(java.lang.String privToken)
      • withContextName

        public Session.Builder withContextName​(java.lang.String contextName)
      • withContextEngineId

        public Session.Builder withContextEngineId​(java.lang.String contextEngineId)
      • withTimeoutMills

        public Session.Builder withTimeoutMills​(int timeoutMills)
      • build

        public Session build()
                      throws java.io.IOException
        Throws:
        java.io.IOException