github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/client/consul/consul.go (about)

     1  package consul
     2  
     3  import (
     4  	"github.com/hashicorp/nomad/nomad/structs"
     5  )
     6  
     7  // TokenDeriverFunc takes an allocation and a set of tasks and derives a
     8  // service identity token for each. Requests go through nomad server.
     9  type TokenDeriverFunc func(*structs.Allocation, []string) (map[string]string, error)
    10  
    11  // ServiceIdentityAPI is the interface the Nomad Client uses to request Consul
    12  // Service Identity tokens through Nomad Server.
    13  //
    14  // ACL requirements
    15  // - acl:write (used by Server only)
    16  type ServiceIdentityAPI interface {
    17  	// DeriveSITokens contacts the nomad server and requests consul service
    18  	// identity tokens be generated for tasks in the allocation.
    19  	DeriveSITokens(alloc *structs.Allocation, tasks []string) (map[string]string, error)
    20  }
    21  
    22  // SupportedProxiesAPI is the interface the Nomad Client uses to request from
    23  // Consul the set of supported proxied to use for Consul Connect.
    24  //
    25  // No ACL requirements
    26  type SupportedProxiesAPI interface {
    27  	Proxies() (map[string][]string, error)
    28  }